Cannot obtain user token based on the enterprise configuration for your app
Hello, I'm having this error trying to connect to my box application.
I'm aware that other people have opened a ticket with the same subject, but any of them have solved my problem.
I think I've cover well all the necessary steps to achieve the connection (create app, create keys pair, allow app....), but despite this I'm having this error:
Message: {"error":"invalid_request","error_description":"Cannot obtain user token based on the enterprise configuration for your app"}
Status: 400
URL: https://api.box.com/oauth2/token
Method: POST
Please, could you help me to solve this issue?
-
Good afternoon ,
for your message, I understand that you are authenticating using JWT credentials.
So, to be able to get tokens you have to enable "Generate user access tokens" on the developer console (as explained, "Allows your application to generate OAuth 2.0 access tokens for users using a JWT grant instead of the user providing credentials.").
Have you had this enabled?
Regards,
-
Hi there, 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 and use the content api with that token.
That finally worked.
Please sign in to leave a comment.
Comments
2 comments