Auth0 Home Blog Docs

How to get user Info like email after successful login

I am using Auth0 in Android, when the user logs in I am getting an access token for my API created in auth0 dashboard and using that access token to call API, the only problem is I need logging user email how to get user info because I can’t call two audiences in webauth, how to achieve it without calling /userinfo endpoint.

WebAuthProvider.init(auth0)
.withScheme(“demo”)
.withParameters(map)
.withAudience(String.format(“http://api.mypgguru.com”, getString(R.string.com_auth0_domain)))
.withScope(“openid profile email offline_access”)
.start(this, webCallback);

The access token issued for your custom API will at this time be a JWT, so you can include a custom claim containing additional information you require (https://auth0.com/docs/scopes/current/custom-claims). This is valid for email or other data that may be required, just have in mind that the value included will be in effect for the lifetime of the token; in other words, if that data changes the old value may still be present in already issued tokens and the API would accept the old value as truth.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.