@junli.antolovich sorry for the late response, but I believe you are requesting scopes in you login page code. Specifically:
.WithScope("openid profile") // <- try "openid profile email"
.WithAudience("https://" & ConfigurationManager.AppSettings("auth0:Domain") & "/userinfo")
This code is effectively requesting profile only. What this code gives you is two things:
- It gives you an access token that is authorized to call the
/userinfo
endpoint to retrieve:
OPTIONAL. This scope value requests access to the End-User’s default profile Claims, which are: name, family_name, given_name, middle_name, nickname, preferred_username, profile, picture, website, gender, birthdate, zoneinfo, locale, and updated_at.
If you want email as well in the id_token you should add the email
scope. Keep in mind this will just update what the /userinfo
endpoint returns and if you are using it what is inside the id_token
.
I am calling GetUserInfoAsync with the accessToken, however I did not specify the scopes, and I do not see GetUserInfoAsync takes scopes or other parameters
Just to make sure I explain it well enough, you do not send scopes when making this call directly. Instead, when you perform the login you are asking Auth0 to give you an access token with the appropriate scopes. Here are the defined scopes, and what properties are returned:
Regards,
Shawn