Downscoping is a way to exchange an existing Access Token for a new one that is more restricted.Documentation Index
Fetch the complete documentation index at: https://developer.box.com/llms.txt
Use this file to discover all available pages before exploring further.
Reasons to downscope
An application might need to share the Access Token with an environment that it does not fully control. A common example of this would be when using Box UI Elements in a web browser. When an application needs to pass an Access Token to the browser there is a potential security risk that needs to be resolved. In order to limit this risk the Access Token can be exchanged for a new token with much stricter permissions.High-level overview
A downscoped token is a token that has fewer permissions (scopes) than the original token, as well as the optional additional restriction to only allow access to a specific file.
Downscoping in practice
To downscope a token, pass thePOST /oauth2/token endpoint an existing Access
Token, a list of scopes, as well as an optional file URL to restrict the token to.
| Parameter | Description |
|---|---|
subject_token | The original token to downscope. This can be a token that was acquired through OAuth 2.0 or JWT token exchange. |
scope | A space-delimited list of to limit the new token to. Any valid scope for the application can be used, though a special set of is available |
resource | An optional full URL path to the file the token should be restricted to. |
box_shared_link | An optional URL for a file or folder on Box. Password protected links are not supported. This option cannot be used in addition to the resource option nor can it be a shared link created on a weblink. |
subject_token_type | Always set to urn:ietf:params:oauth:token-type:access_token |
grant_type | Always set to urn:ietf:params:oauth:grant-type:token-exchange |
Downscoped Access Token Object
A downscoped Access Token returned by thePOST /oauth2/token endpoint contains
extra information on the specific restrictions.
restricted_to entries that will contain
each combination of object and scope that the new token has the permissions for.
