You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.
I am trying to sign a user in, in a normal controller. I have something along the lines of:
var claims = new List<Claim>
{
new Claim(JwtClaimTypes.Subject, "xxx-xxx-xx-xxx),
new Claim(JwtClaimTypes.PreferredUserName, "someusername"),
new Claim(JwtClaimTypes.Email, "foo@bar"),
new Claim(JwtClaimTypes.EmailVerified, "foo@bar:),
new Claim(JwtClaimTypes.IdentityProvider, "idsvr"),
};
var ci = new ClaimsIdentity(claims, "password", JwtClaimTypes.PreferredUserName, JwtClaimTypes.Role);
var cp = new ClaimsPrincipal(ci);
await HttpContext.Authentication.SignInAsync("myscheme", cp);
And I get an exception saying InvalidOperationException: name claim is missing
In the constructor of the ClaimsIdentity I specified my name claim to be JwtClaimTypes.PreferredUsername (which is "preferred_username")
If I do add a name claim to my claims list, then sign in works fine with the above snippet. However we actually don't have name claims in our system. We want to use the "preferred_username" as the name claim in your abstractions.
The text was updated successfully, but these errors were encountered:
I am trying to sign a user in, in a normal controller. I have something along the lines of:
And I get an exception saying
InvalidOperationException: name claim is missing
In the constructor of the ClaimsIdentity I specified my name claim to be
JwtClaimTypes.PreferredUsername
(which is "preferred_username")If I do add a name claim to my claims list, then sign in works fine with the above snippet. However we actually don't have name claims in our system. We want to use the "preferred_username" as the name claim in your abstractions.
The text was updated successfully, but these errors were encountered: