Skip to content

Instantly share code, notes, and snippets.

Created August 3, 2017 13:58
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mclasson/6c1ba5b4843907f338b0bf1e4302a541 to your computer and use it in GitHub Desktop.
public async Task<IActionResult> Index()
var principal = User.Identity as ClaimsIdentity;
var idClaim = principal.Claims.Where(i => i.Type == "")
if(idClaim == null)
principal.AddClaim(new Claim("", "MyCustomId"));
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
await HttpContext.SignInAsync(User);
return View();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment