Skip to main content
Question

App can't get user tokens

  • May 22, 2025
  • 6 replies
  • 36 views

Forum|alt.badge.img

When calling BoxJWTAuth.UserToken(userId), I'm getting the following error:

The API returned an error [BadRequest] invalid_request - Cannot obtain user token based on the enterprise configuration for your app.

I believe I have my developer account and app set up correctly.

In the dev console my app configuration is as follows:

Authentication Method: OAuth2.0 with JWT (Server Authentication)
Application Access: Enterprise
Application Scopes: (all checked)
Advanced Features: Perform Actions as Users (on) Generate User Access Tokens (on)

In the admin console, I've authorized my custom app and it's enabled.

Is there anything else that I need to do, in order to allow the app to get user tokens?

Thanks,

Damon

6 replies

Forum|alt.badge.img

I should also point out, that I am able to make other authenticated calls such as EnterpriseEventsAsync() ... so that rules out a local auth config issue.


Forum|alt.badge.img

Have the scopes changed since you initially authorized the application in the admin console? You'll need to reauthorize the application anytime the scopes change.

What Box user are you trying to generate the token for? Is this happening for all user ids?


Forum|alt.badge.img

I have re-authorized the app. I'm using my developer account, so I am the only user.


Forum|alt.badge.img

Do you have Admin rights to get the user ids? This needs to be granted under Users & Groups > Managed Users > Open user details > Edit User Access Permissions > 

 

BOX_aF3No2Rl-yc0ZvDmtRXjDA.png


Forum|alt.badge.img

As the account admin, I don't have this option. 

BOX_0hHScmXfELFPaEdB6OSlgw.png


Forum|alt.badge.img

Hello Charles, 

Could you try creating a brand new JWT application and trying the same call? We recently discovered a bug that was presenting this same error. I believe your issue may be related. 

 

Best, 

Kourtney

Box Technical Support Engineer