Skip to content

'error_description': 'Current date/time MUST be before the expiration ' #499

@sasadangelo

Description

@sasadangelo

Description of the Issue

I run this program and I get:

from box_sdk_gen import BoxClient, BoxJWTAuth, JWTConfig


jwt_config = JWTConfig(
    client_id="49xxxxxq07wp",
    client_secret="02xxxxxxbPxwr",
    jwt_key_id="7cgeazfu",
    private_key="-----BEGIN ENCRYPTED PRIVATE KEY-----\nMIxxxxxxxm4c=\n-----END ENCRYPTED PRIVATE KEY-----\n",
    private_key_passphrase="3abxxxxx2b2cc",
    enterprise_id="4xxxxx",
)
auth = BoxJWTAuth(jwt_config)
client = BoxClient(auth=auth)
access_token = auth.retrieve_token()

Timestamp: 2025-03-10 11:31:45.040844
Underlying error: None
Message: 400 ; Request ID:
Request:
Method: POST
URL: https://api.box.com/oauth2/token
Query params:
{}
Headers:
{ 'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'box-python-generated-sdk-1.9.0',
'X-Box-UA': 'agent=box-python-generated-sdk/1.9.0; env=python/3.9.21'}
Body:
'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&client_id=xxxxxx&client_secret=xxxxxxx'
Response:
Status code: 400
Headers:
{ 'Alt-Svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000',
'Transfer-Encoding': 'chunked',
'cache-control': 'no-store',
'content-type': 'application/json',
'date': 'Mon, 10 Mar 2025 10:31:45 GMT',
'set-cookie': 'box_visitor_id=67cebf90f33cb2.53718461; expires=Tue, 10 '
'Mar 2026 10:31:44 GMT; Max-Age=31536000; path=/; '
'domain=.box.com; secure; SameSite=None, '
'bv=SRCHPLT-2449; expires=Mon, 17 Mar 2025 10:31:44 GMT; '
'Max-Age=604800; path=/; domain=.app.box.com; secure, '
'cn=97; expires=Tue, 10 Mar 2026 10:31:44 GMT; '
'Max-Age=31536000; path=/; domain=.app.box.com; secure, '
'site_preference=desktop; path=/; domain=.box.com; '
'secure',
'strict-transport-security': 'max-age=31536000',
'via': '1.1 google'}
Code: None
Context Info:
{}
Request Id: None
Help Url: None
Body:
{ 'error': 'invalid_grant',
'error_description': 'Current date/time MUST be before the expiration '
"date/time listed in the 'exp' claim"}
Raw body: {"error":"invalid_grant","error_description":"Current date/time MUST be before the expiration date/time listed in the 'exp' claim"}

The problem is reported only on Mac when I run it on my office network. The point is that I contacted team but they want to know what could be the potential issues on the server side to do a correct diagnoses on their servers.

Steps to Reproduce

See above

Expected Behavior

It can get the bearer token

Error Message, Including Stack Trace

See boave

Screenshots

n/A

Versions Used

Python SDK: 1.9.0 and 1.12.0
Python: 3.9

Metadata

Metadata

Labels

bugSomething isn't workingstaleAdded to issues should be staled

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions