You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting a similar error when the claims value is a java.lang.String. Using the auth0 API, updated_at is returned as 2018-06-12T01:35:40.304Z. Even though this is a valid ISO Date, this is getting stored as a java.lang.String in the underlying claims map from the JWT, which is ultimately resulting in the IllegalArgumentException. I'm not sure why getClaimAsInstant is assuming that the JWT library would have the intelligence to parse Strings into Dates - it doesn't attach any semantics to the fields.
java.lang.IllegalArgumentException: Unable to convert claim 'updated_at' of type 'class java.lang.String' to Instant.
at org.springframework.security.oauth2.core.ClaimAccessor.getClaimAsInstant(ClaimAccessor.java:96)
at org.springframework.security.oauth2.core.oidc.StandardClaimAccessor.getUpdatedAt(StandardClaimAccessor.java:218)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
updated_at | number | Time the End-User's information was last updated. Its value is a JSON number representing the number of seconds from 1970-01-01T0:0:0Z as measured in UTC until the date/time.
Looks like auth0 is not storing it as a number as expected, hence the error. You can always use getClaimAsString(StandardClaimNames.UPDATED_AT) to avoid the error.
Activity
sirianni commentedon Jun 12, 2018
I'm getting a similar error when the claims value is a
java.lang.String. Using theauth0API,updated_atis returned as2018-06-12T01:35:40.304Z. Even though this is a valid ISO Date, this is getting stored as ajava.lang.Stringin the underlying claims map from the JWT, which is ultimately resulting in theIllegalArgumentException. I'm not sure whygetClaimAsInstantis assuming that the JWT library would have the intelligence to parse Strings intoDates - it doesn't attach any semantics to the fields.jgrandja commentedon Jun 13, 2018
@sirianni As per the spec, in 5.1. Standard Claims:
Looks like
auth0is not storing it as a number as expected, hence the error. You can always usegetClaimAsString(StandardClaimNames.UPDATED_AT)to avoid the error.