Auth0 Home Blog Docs

created_at not returned in userInfo

userinfo
social-connections
authorize

#1

Hello, why isn’t the created_at field returned when calling userInfo as indicated in the docs; only updated_at?

Here’s my code:

private webAuth = new auth0.WebAuth({
	domain: AUTH_CONFIG.domain,
	clientID: AUTH_CONFIG.clientID,
	redirectUri: AUTH_CONFIG.callbackURL,
	audience: `https://${AUTH_CONFIG.domain}/userinfo`,
	responseType: 'token id_token',
	scope: 'openid email profile'
});

public loginWithGoogle() {
	this.webAuth.authorize({connection: 'google-oauth2'});
}

Thanks in advance!


#2

You’re performing an authentication and API authorization request (aka audience parameter). The use of API authorization implies that the authentication response will strictly follow the OpenID Connect (OIDC) specification.

This means that by default only claims specified as part of that specification will be included in the issued ID token. The updated_at is one of the standard claims, however, created_at is not a standard OIDC claim so it is not returned.

You can include custom claims in the issued ID token, although they need to be namespace, so you could include the information available in the created_at field as part of a custom namespaced claim. For reference information on how to accomplish this see:

https://auth0.com/docs/api-auth/tutorials/adoption/scope-custom-claims#custom-claims


#3