Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

OIDC, I cannot add extra claims from userinfo endpoint #1449

Closed
@rcladmin

Description

@rcladmin

In ASPNET Core 2.0, extra claims from the userinfo endpoint are not added to User.Claims in a MVC Client application. This worked in Core 1.1, what am I doing wrong? All I am getting is sid,sub,idp and email , all the other claims (including my custom claims) from the userinfo endpoint is missing. I checked the access_token int jwt.io and all the claims are there.

services.AddAuthentication(options =>
            {
                options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
            })
            .AddCookie()
            .AddOpenIdConnect(o =>
            {
                o.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; 
                o.RequireHttpsMetadata = false;
                o.Authority = "xxxxx";
                o.ClientId = "xxxx";
                o.ClientSecret = "xxxx";
                o.ResponseType = "code id_token";
                o.GetClaimsFromUserInfoEndpoint = true;
                o.SaveTokens = true;
                o.SecurityTokenValidator = new JwtSecurityTokenHandler
                {
                    InboundClaimTypeMap = new Dictionary<string, string>()
                };
                o.TokenValidationParameters.NameClaimType = "email";
            });

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions