The payload validation fails for a variety of ISO 8601 formats:
2024-07-06 00:00:00
2024-07-06T00:00:00
20240706T000000.000000Z
full errors
Auth0Error: 400: Payload validation error: 'Object didn't pass validation for format date-time: 2024-07-06T00:00:00' on property client_authentication_methods.private_key_jwt.credentials[0].expires_at (The ISO 8601 formatted date representing the
expiration of the credential. If not specified (not recommended), the credential never expires).
Auth0Error: 400: Payload validation error: 'Object didn't pass validation for format date-time: 2024-07-06 00:00:00' on property client_authentication_methods.private_key_jwt.credentials[0].expires_at (The ISO 8601 formatted date representing the
expiration of the credential. If not specified (not recommended), the credential never expires).
Auth0Error: 400: Payload validation error: 'Object didn't pass validation for format date-time: 20240706T000000.000000Z' on property client_authentication_methods.private_key_jwt.credentials[0].expires_at (The ISO 8601 formatted date representing the
expiration of the credential. If not specified (not recommended), the credential never expires).
workaround
removing the expires_at
line works, but is obviously not recommended.
code
today = dateutil.utils.today()
next_year = today + relativedelta(years=1)
next_year_iso8601_formatted = next_year.isoformat()
payload = {
"is_token_endpoint_ip_header_trusted": False,
"name": name,
"description": description,
"app_type": "non_interactive",
"is_first_party": True,
"oidc_conformant": False,
"jwt_configuration": {
"lifetime_in_seconds": 36000,
"scopes": {},
"alg": "RS256",
},
"sso": True,
"cross_origin_authentication": True,
"sso_disabled": True,
"custom_login_page_on": True,
"client_metadata": {},
"native_social_login": {
"apple": {
"enabled": False
},
"facebook": {
"enabled": False
}
},
"refresh_token": {
"rotation_type": "non-rotating",
"expiration_type": "non-expiring",
"leeway": 0,
"token_lifetime": 2592000,
"infinite_token_lifetime": True,
"idle_token_lifetime": 1296000,
"infinite_idle_token_lifetime": True
},
"organization_usage": "deny",
"organization_require_behavior": "no_prompt",
"client_authentication_methods": {
"private_key_jwt": {
"credentials": [
{
"credential_type": "public_key",
"name": f"{name}.pem.pub",
"pem": pub_key,
"alg": "RS256",
"parse_expiry_from_cert": False,
"expires_at": next_year_iso8601_formatted
}
]
}
},
"grant_types": [
"client_credentials"
],
}
with open(mgmt_access_token_file, 'r') as f:
auth0_management_token = f.read()
m_auth0 = Auth0(f"{domain}.us.auth0.com", auth0_management_token)
r = m_auth0.clients.create(payload)
print(json.dumps(r, indent=4))
Ask: what is an example of a correct ISO 8601 format that this endpoint will accept?