Thanks much for the response
Here is the login page code in vb.net:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim client = New AuthenticationApiClient(New Uri($"https://{ConfigurationManager.AppSettings("auth0:Domain")}"))
Dim request = Me.Request
Dim redirectUri = New UriBuilder(request.Url.Scheme, request.Url.Host,
If(Me.Request.Url.IsDefaultPort, -1, request.Url.Port),
VirtualPathUtility.ToAbsolute("~/LoginCallback.ashx"))
Dim authorizeUrlBuilder = client.BuildAuthorizationUrl() _
.WithClient(ConfigurationManager.AppSettings("auth0:ClientId")) _
.WithRedirectUrl(redirectUri.ToString()) _
.WithResponseType(AuthorizationResponseType.Code) _
.WithScope("openid profile") _
.WithAudience("https://" & ConfigurationManager.AppSettings("auth0:Domain") & "/userinfo")
Dim returnUrl = New UriBuilder(request.Url.Scheme, request.Url.Host,
If(Me.Request.Url.IsDefaultPort, -1, request.Url.Port),
VirtualPathUtility.ToAbsolute("~/logOn.aspx")).ToString()
authorizeUrlBuilder.WithState(returnUrl)
Dim authUrl = authorizeUrlBuilder.Build().ToString()
Response.Redirect(authUrl)
End Sub
and here is the logincallback code
Imports Auth0.AuthenticationApi
Imports Auth0.AuthenticationApi.Models
Public Overrides Async Function ProcessRequestAsync(context As HttpContext) As Task
Dim client = New AuthenticationApiClient(New Uri($"https://{ConfigurationManager.AppSettings("auth0:Domain")}"))
Dim request As AuthorizationCodeTokenRequest = New AuthorizationCodeTokenRequest()
request.ClientId = ConfigurationManager.AppSettings("auth0:ClientId")
request.ClientSecret = ConfigurationManager.AppSettings("auth0:ClientSecret")
request.Code = context.Request.QueryString.Item("code")
request.RedirectUri = context.Request.Url.ToString()
Dim token As AccessTokenResponse = Await client.GetTokenAsync(request)
Dim profile As UserInfo = Await client.GetUserInfoAsync(token.AccessToken)
…
End Function
So to answer your questions, 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. So which method should i use in order to call /userinfo endpoint with the scope?
From the custom DB, here is the script to map the user profile:
var profile = {
user_id: 'MMC|' + user.MMCUserId,
nickname: user.NickName,
username: user.Email,
email: user.Email,
given_name: user.GivenName,
family_name: user.FamilyName
};
and here is the user profile I get from calling:
I do need the user’s email address, so that I can look up the user in my DB. In case of the SSO - which I meant the authentication is going through a different enterprise connection - SAML in this case. I think you have the answer for me with how to call the /userinfo endpoint with the scope, so that i can get the email back.
Again, thanks much for the help!