Authorization header. The flow you use to get the token determines whose Box permissions the agent uses.
The agent can reach only content that this identity can already access, regardless of what you reference in the request. If you pass a file ID the caller can’t see, the agent behaves as if the content doesn’t exist.
Before you start, set up a platform app with the required scopes.
OAuth 2.0
Follow the OAuth 2.0 guide to get an access token, then pass it in theAuthorization header. The token is tied to the user who authorized your app, so the agent’s access matches that user’s access.
Create a User platform app in the Developer Console, configure at least one redirect URI, and enable the scopes listed in Set up a platform app. To get the token, see OAuth 2.0 with SDKs or OAuth 2.0 without SDKs.
For an example request with an OAuth 2.0 token, see Send your first request.
JWT
Create a Server app, set up JWT, and have an admin authorize the app. New Server apps preselect Client Credentials Grant, so select JWT when you create the app. By default, the token belongs to the app’s service account. The agent sees only content that the service account owns or is collaborated on. To get a service account token, see JWT with SDKs or JWT without SDKs. Call the API with the service account token or developer token:cURL
Act on behalf of a managed user
To have the agent use a specific user’s permissions instead of the service account’s, add theas-user header with that user’s ID. Before you do, configure your app:
- Set App Access Level to App + Enterprise Access in the Developer Console.
- In Configuration > Additional Configuration, enable Make API calls using the as-user header.
cURL
as-user:
- The authenticated identity must be an Admin or Co-Admin.
- You can’t pass the service account’s own user ID.
- You can reach only content that the enterprise owns or controls.
- Passing the authenticated user’s own ID returns
403 Forbidden.
as-user header, generate a user access token and use it like a service account token.
Client Credentials Grant
Create a Server app with Client Credentials Grant, and have an admin authorize the app. Your app exchanges its client ID and client secret for an access token, and the subject you request the token for determines whose permissions the agent uses:
To set up the app and request a token, see Set up an app with Client Credentials Grant. Send the token in the
Authorization header, as in the JWT example. CCG tokens expire after 60 minutes and don’t come with a refresh token, so request a new token when the current one expires.
