Hi!
I'm new to the Box API, and I'm trying (and failing) to get the authentication example working.
I've created a Custom App (in my free individual account, FWIW) and attached a key pair directly in the developer console. I downloaded the JSON file that generated.
Now, I'm trying to follow the Python example at https://github.com/box/box-python-sdk/blob/main/docs/usage/authentication.md#server-auth-with-jwt.
Here's my code, copied from the documentation:
from boxsdk import JWTAuth, Client
auth = JWTAuth.from_settings_file('0_r7gzwmqs_config.json')
client = Client(auth)
service_account = client.user().get()
print(f'Service Account user ID is {service_account.id}')
The file 0_r7gzwmqs_config.json is the JSON I downloaded when I created the key pair. Here are the keys (and censored values) in that file:
{
"boxAppSettings": {
"clientID": "...",
"clientSecret": "...",
"appAuth": {
"publicKeyID": "...",
"privateKey": "...",
"passphrase": "..."
}
},
"enterpriseID": "0"
}
boxsdk.exception.BoxOAuthException:
Message: Please check the 'sub' claim. The 'sub' specified is invalid.
Status: 400
URL: https://api.box.com/oauth2/token
Method: POST