nativescript-auth0
nativescript-auth0 copied to clipboard
How to get name and profile image and stuff?
Hello!
Thanks for making this plugin. It is working for me on ios (the only platform I'm deploying to right now).
In the success callback though I am seeing an object that looks like this:
{
"access_token": "7bUqOLLKRBBJ39o5EXSmD5HoHBI7PBYc",
"token_type": "Bearer",
"id_token": "eyJhbGciOiJSUzI1NiIsInR5cdFeIkpXVCIsImtpZCI6IkpZTEd2N2E4LXRnTVdFTmFvQVhoeSJ9.eyJpc3MiOiJodHRwczovL2Vucm9sbGVkLWFnZW50LXN0dWR5LWFwcC51cy5hdXRoMC5jb20vIiwic3ViIjoiZ29vZ2xlLW9hdXRoMnwxMTU2MDMwOTAyMDAxMTc1NjM3MDMiLCJhdWQiOiJYMkdKZVVZUUY4WkhtRHpuNTNyMzQ1aVJIaUJwZE1ndyIsImlhdCI6MTYwMDI3NDQ1NiwiZXhwIjoxNjAwMzEwNDU2fQ.cMrty_kD9u8pDclevEMqI7feNHhBkVR3oBIl9u0aq7CfXaPeobglVhX5Y8C1nTmGgDCORVYiVGZtFHjY6V-QdVfVldx0Fafel4X9uK9xmEum0-gyRMHP9QwjD2G3l7OW8o6xHrYyjKOe0mSdGP_DKnPu93UQN9STA1asQM9WxqsXc9sZu1hU9pu88lEAkSjkGnq2JDeHvSrXDbmfPXK2AIxQo8uCpzdwRbGvpC_T--EUUmcUpUjcnnWkebg1YODVgHZN-6Bkncisv50anwd6kQuLJVIqjXhdVXaJWmpP0_APG5BpBfx26WRE12BO-W3vMUZ6-kvrSS9uDRPA3yJ22Q",
"refresh_token": "MB03VQfAQ1qVDyBxt60Vsxel75qx9lQwkoGIJIacF5AQi",
"expires_in": 86400,
"expires_at": "2020-09-17T16:45:03.268Z",
"scope": "openid offline_access"
}
I was expecting to have more stuff in this object such as the user's name and a link to his or her profile image.
In there another url needed to be called in order to get this or some settings that can be configured to get more data back?
Thanks!
I see there is a "getClientInfo" call, but the response it gives me just looks like this:
{"sub":"google-oauth2|115603090200112342333"}
I can see the UserInfo objecthas many more properties available... not sure why I am only getting "sub"... 🤔
I'm getting only "sub" for twitter login too. Interestingly, Linkedin signin button just takes me to a "bummer, something went wrong" page"
AHAA!!
Turns out I just needed to change the "scope" value from openid offline_access to openid profile email.
I created a PR here changing this to the default in the README and adds I think a nice call out that:
- these scope options are not specific to this plugin, nativescript, or even auth0, but rather can be any of the standardized ("standard claims")[https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims]
and
- the scope options determine what is returned in the userInfo call.
Cool :)
Leaving this open so admins see it. Feel free to close 👍