Cannot obtain user token based on the enterprise configuration for your app
Getting this error message when trying to connect with app user. settings are correct for the app..
-
Getting:
"error": "invalid_request",
"error_description": "Cannot obtain user token based on the enterprise configuration for your app"
The app user is valid.
The app is configured for Enterprise access.let client = sdk.getAppAuthClient('user', '');
client.files.get('', null, (err, info) => {
console.log("INFO: "+JSON.stringify(info));
console.log("ERR: "+JSON.stringify(err));
});What am I missing?
-
Update:...
I setup another box account (business trial), created new app with Enterprise access and then authorised it under Admin.
Created a new app user through the API, no problem.
Attempted to retrieve contents of root folder as follows:let client = sdk.getAppAuthClient('user', userid);
client.folders.get('0', null, (err, info) => {
console.log("INFO: "+JSON.stringify(info));
console.log("ERR: "+JSON.stringify(err));
});Got same error: "Cannot obtain user token based on the enterprise configuration for your app"
Threw up my hands.... Then went back into admin panel and randomly reauthorized the app.
Success!
Is there a edge case bug, first authorisation not currently working? -
Did you delete authorization completely and then re-add authorization?
Or did you just use the "re-authorize your app" feature?
I'm stuck in the same spot. Created app users successfully.
Set access to "Only App Users of this App". but when I try to call getAppUserTokens(),
it gives the error like above.
-
Hi, I my case was able to resolve this issue by finding a user and using that user to access the folder.
The app needs to have permission to Generate User Access Token, use Enterprise access, have access to Read and Write all files and still the user needs to have acess to the folder, using JWT.
It looks like the problem I was having was that the "current" (jwt) user of the app, or the user that was related to the creation of the app which seemed to be a special user, could not be used to access content.
So either trying to get a user token for that user or trying to access folders was causing errors:
"Cannot obtain user token based on the enterprise configuration for your app" when trying to get a user token.
"Invalid value 'd_.... 'folder' with value 'd_...' not found" when trying to query a folder.What I did was, knowing a user that had access to the folder, use get all users ( https://developer.box.com/v2.0/docs/get-all-users ) sending the filter_term param to find that user id, and then generate a user token for that user id, and use the content api with that token.
That finally worked.
Please sign in to leave a comment.
Comments
9 comments