400: {"error":"invalid_grant","error_description":"Please check the 'sub' claim. The 'sub' specified

SOLVED
Go to solution
Highlighted
New Contributor

400: {"error":"invalid_grant","error_description":"Please check the 'sub' claim. The 'sub' specified

Hi,

  • I am doing box integration with Salesforce. We are using JWT for authentication. While authentication we are getting invalid sub error. I am passing the enterpriseId in string format and also my app has permission for generating user token and perform action as user. What else could be reason for this error.
1 REPLY 1
Highlighted
Box Employee

Re: 400: {"error":"invalid_grant","error_description":"Please che

@poorva25 

 

When the sub is your enterprise ID, then the box_sub_type needs to be enterprise.

 

sub: config.enterpriseID,
box_sub_type: "enterprise",

 

Similarly when trying to create a JWT for a user the sub is your user ID and the box_sub_type should be user.

 

Can you make sure that this is correct in your claim? You can see a full example over here.

 

https://developer.box.com/guides/authentication/jwt/without-sdk/


---
Developer Advocate @ Box