Error while using JWT Oauth with Python
Hi,
using the resources provided, now i am getting following error. Can you please let me know what i am doing wrong and how to fix it.
Error -
ValueError: Could not deserialize key data.
Code
from boxsdk import JWTAuth from boxsdk import Client # Configure JWT auth object sdk = JWTAuth( client_id="my_client_id", client_secret="my_client_Secret", enterprise_id="enterprise_Id", jwt_key_id="key_id", rsa_private_key_file_sys_path = "C:/Users/Downloads/boxAPIAccess.pem", rsa_private_key_passphrase = b'pass_phrase' )
-
Could you check the format of your private key file? There is a very specific format it needs to be in for the parser to correctly read it, and errors often stem from it being subtly different than what the underlying JWT library can handle.
For example, a valid private key that I can confirm works looks like this:
-----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: AES-256-CBC,7629999DB4ECE43F49EAB01DA136CFE8 <<< BASE64 ENCODED DATA GOES HERE >>> -----END RSA PRIVATE KEY-----
The beginning and ending lines — as well as the line breaks — are required.
Please sign in to leave a comment.
Comments
2 comments