Here is my structure.
-Asp.Net c# Application with IdentityServer 4 used to register and authenticate a user.
-Asp.Net C# Web API that serve some services that used Identity4Server to Authorize a user
-Angular 4 application with ocid-client that use the ASP.Net C# Application to authenticate the angular app.
Question : Actually, when I Print the Authenticated User Claims in the Web API application, I do not see the User Email. Is there a way to see it in the claim.
In WEB API application
if (User.Identity.IsAuthenticated)
{
var claims = User.Claims.ToList();
//Would like to see the User Email Informations
var AspnetUserId = User.Claims.FirstOrDefault(p => p.Type == "sub").Value;
this.ContactService.UpdateUserProfile(AspnetUserId,profile);
}
In Indentity Server Application
new Client
{
ClientId = "tgc",
ClientName = "Tag Twee Client Angular",
AllowedGrantTypes = GrantTypes.Implicit,
RequireConsent = false,
AllowAccessTokensViaBrowser = true,
RedirectUris = { "http://localhost:5002/login" },
PostLogoutRedirectUris = { "http://localhost:5002/logout" },
AllowedCorsOrigins = { "http://localhost:5002" },
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
"TTAPI",
IdentityServerConstants.StandardScopes.Email
}
}