Getting Please check the 'exp' claim Exception
AnsweredHi,
We are suddenlt facing the below exception from 2 weeks when we try to connect to box. It was working fine before. Please help on how to fix this issue.
{"error":"invalid_grant","error_description":"Please check the 'exp' claim."}
-
This error happens when the Unix time on your local machine and the Box server are out of sync.
To fix this error, update the Unix time on your machine to match the Unix time from this site. Then retry your request to generate the App User access token.
Please let me know if that fixes the error?
-
I'm getting this error only during deployment, which is confusing. We use the Box client as a custom storage backend for a Django-based app, and in the initialization stages, Django seems to be creating instances of the client. Since the client is coded as recommended in the Python SDK documentation:
from boxsdk import JWTAuth auth = JWTAuth( client_id='YOUR_CLIENT_ID', client_secret='YOUR_CLIENT_SECRET', enterprise_id='YOUR_ENTERPRISE_ID', jwt_key_id='YOUR_JWT_KEY_ID', rsa_private_key_file_sys_path='CERT.PEM', store_tokens=your_store_tokens_callback_method, ) access_token = auth.authenticate_instance() from boxsdk import Client client = Client(auth)
, a call to "authenticate instance" happens during this initialization process. Only during deployment does this "Please check the 'exp' claim" error happen and we get build failures as a result. All subsequent requests to the Box client are successfully authenticated, so I don't believe a Unix system clock issue could explain this.
-
I don't know if you solved your issue on a Windows system, but I'll go ahead and post what I did in case someone else has a similar problem.
I was a bit confused with the Unix-centric response, but once I realized we are just dealing with Internet time-syncing and could see that the computer running my Box app was about 30+ seconds out of sync, it became clear.
What I do is (if possible) get on the computer which is showing the 'exp' claim exception and open a browser to https://www.time.gov/ which is the NIST sponsored time server. Check the time displayed in the browser with the local time on your computer (hopefully, displayed in the tray). At a new minute, both times should change within a second or two. If your computer is out of sync by more than a few seconds, ensure Windows is using a timeserver to get the current time and make sure it updates regularly. Windows will sometimes fail to tell you it hasn't connected with its designated timeserver in a while, so sometimes you need to "kick start it". I have 3 desktop computers, a Comcast cable box, and an iPhone -- all are in sync within about a second, so it's not that hard. If you have any questions, I'll try to help.
-
Problem solved. My Windows time was out of sync with e.g. https://www.time.gov/ by around 45s. I synced my time on the windows machine again and it works like a charme now. Thanks rbratton!
Please sign in to leave a comment.
Comments
11 comments