Okta.AspNet Mapping Claims

Hello, I’m trying to use the Okta.AspNet libraries (pre-Core) and the redirect/Okta-hosted model. My primary issue is that the middleware is assigning the “Name” property of User.Identity as “{firstname} {lastname}” and the existing application requires the User.Identity.Name to be the username. This appears to be coming back to me from Okta (in some form, at least) in the claims as “preferred_username” but all my attempts to map the value appropriately have been fruitless. I’m instantiating as follows, and I’m grateful for any assistance you can provide.

           app.UseOktaMvc(new OktaMvcOptions()
                GetClaimsFromUserInfoEndpoint = true,
                OktaDomain = ConfigurationManager.AppSettings["okta:OktaDomain"],
                ClientId = ConfigurationManager.AppSettings["okta:ClientId"],
                ClientSecret = ConfigurationManager.AppSettings["okta:ClientSecret"],
                AuthorizationServerId = string.Empty,
                RedirectUri = ConfigurationManager.AppSettings["okta:RedirectUri"],
                PostLogoutRedirectUri = ConfigurationManager.AppSettings["okta:PostLogoutRedirectUri"],
                Scope = new List<string> { "openid", "email", "profile" },
                OpenIdConnectEvents = new OpenIdConnectAuthenticationNotifications
                    SecurityTokenReceived = (context) =>
                        context.Options.TokenValidationParameters.NameClaimType = "preferred_username";
                        return Task.CompletedTask;

Hi @rduff! Double-checking what is the requirement of your application. Do you need the user’s first and last name? The preferred_username will be the same as their email.