Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the substitute of CreateIdentityAsync method in Asp.Net Core 1.0 RTM?

In ASP.Net Core1.0 RTM, I'm trying to create Identity using this method:

userManager.CreateIdentityAsync()

but I get this error:

'UserManager' doesnot contain a definition for 'CreateIdentityAsync'.

What is going wrong?

like image 607
Dipika Avatar asked Aug 18 '16 15:08

Dipika


1 Answers

You can try IUserClaimsPrincipalFactory

ClaimsPrincipal claimsPrincipal = await _claimsPrincipalFactory.CreateAsync(user);
((ClaimsIdentity) claimsPrincipal.Identity).AddClaim(new Claim("user_id", user.Id.ToString()));
like image 114
Atchitutchuk Avatar answered Nov 15 '22 22:11

Atchitutchuk