Admin token does not have sufficient scope
See original GitHub issueHi, trying to run the example given:
var adminToken = boxJWT.AdminToken(); //valid for 60 minutes so should be cached and re-used
var adminClient = boxJWT.AdminClient(adminToken);
//for example, get the admin's root folder items
var items = await adminClient.FoldersManager.GetFolderItemsAsync("0", 500);
I can retrieve admintoken, but when I attempt the GetFolderItemsAsync call I get this:
Bearer realm=“Service”, error=“insufficient_scope”, error_description=“The request requires higher privileges than provided by the access token.”
I can use that admintoken to do things like list enterprise users though. I can also follow the example to create a new app user and list THAT user’s folders using that user’s token.
I’m using a new developer account with no other users, and am syncing my folders to my desktop. I have enabled all scope options that I can:
Even though I’m getting this far, I assume I’m still missing something in my account setup to enable listing of the folders from the admin token?
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Access token does not have sufficient scope - Help - Intuit
During the access-token request, your application sends one or more values in the scope parameter. Ensure you are using all the required scopes...
Read more >Insufficient Scope error. Token does not contain scopes
In my application each administrator has app_metdata attribute that defines whether or not they have the admin role. I am using a rule...
Read more >Insufficient Scope error. Token does not contains scopes
In my application each administrator has app_metdata attribute that defines whether or not they have the admin role.
Read more >User does not have scope "uaa.user" / JWT token ...
Calling the UAA token endpoint fails with: "error": "insufficient_scope", "error_description": "Insufficient scope for this resource", "scope": "uaa.user".
Read more >What does the error “Access token does not have sufficient ...
When I try to save a new credential in my iOS app, I got this error message. Any idea how to fix it...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone else following, this is caused by the fact that the app has it’s own context in the BoxClient object which you declared and used to create your tokens.
Admins and Apps can not only not own content, they can’t manipulate content. Users and App Users must be used. It’s not currently very clear in the example code, but you must create a “user context”…
Until you create and use that user context, you are attempting to perform restricted actions as the app when you really want to perform them as a user.
While it’s possible to “switch” that BoxClient context from that of an admin to that of a user, it is also just fine and dandy to have a BoxClient object for each context and use the appropriate object for specific actions. For example, you would use the adminClient for user CRUD while you’d use the userClient for file and folder CRUD.
Yes, exactly. If you have content that you historically would have had the admin account own (like it’s shared across all app users) you should create a dedicated app user for that content. The app admin account, for security reasons, is no longer allowed to own content.