Can't find service account ID
Hi,
I have an app created with the Server Authentication (Client Credentials Grant), with app access level set to "App Access Only", and I'm failing to get an access token. I keep getting the error: "Grant credentials are invalid when I am trying to generate an access token:
curl --location --request POST 'https://api.box.com/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=6gmvv0j2unzywuuolljq5ae3037zzwpy' \
--data-urlencode 'client_secret=<<CLIENT_SECRET>>' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'box_subject_type=user' \
--data-urlencode 'box_subject_id=<<my user id>>'
Now I think the issue might be with the subject id, as I am using my user id. I have seen other posts mention that a service account id should be used, but I do not see a service account anywhere, nor can I figure out how to locate it? I do not see it in any of the tabs for the app in the developer console. And when I call the "https://api.box.com/2.0/users/me" endpoint with a developer token I get from the console it just returns my user info.
Thank you for your help
Thanks,
-
Hello!
As noted here, you will want to pass in enterprise and the enterprise id, assuming you have the app access + enterprise enterprise selected... not a user and user id.
Otherwise, to find the id of the service account, you can use the Box CLI or Postman to find the service account user. See more about that user type here.
Thanks,
Alex, Box Developer Advocate
サインインしてコメントを残してください。
コメント
1件のコメント