JWT Error: invalid_grant, Please check the 'sub' claim. The 'sub' specified is invalid.
AnsweredHi,
When trying to authenticate with JWT, I am getting the following error:
{"error":"invalid_grant","error_description":"Please check the 'sub' claim. The 'sub' specified is invalid."}
I am using the code from docs.
!pip install "box-sdk-gen[jwt]"
from box_sdk_gen import BoxClient, BoxJWTAuth, JWTConfigI read a couple of different posts, so I see multiple reasons for this, but it's hard to tell, because the previous posts were usually closed without resolving it, eg. this one
jwt_config = JWTConfig.from_config_file(config_file_path="./config.json")
auth = BoxJWTAuth(config=jwt_config)
client = BoxClient(auth=auth)
service_account = client.users.get_user_me()
print(f"Service Account user ID is {service_account.id}")
1. I have not correctly authenticated the app in the dev console. However, when I create a "custom app" with JWT as authentication method, I don't see the authentication tab in the apps setting. Why is that?

I believe I saw this option when my account was created but it is no longer available.
2. The option for JWT and Client Credentials Grant might be only available for paying users? This was mentioned here but it is not mentioned anywhere in the documentation.
Can someone please help me verify this? Thanks!
-
Hi Jana,
Welcome to Box Community and glad to assist!
For your API related questions, please head over to forum.box.com in order to work with our Developer team.
Thanks for posting!
Please sign in to leave a comment.
Comments
1 comment