public async Task <IActionResult> Profile(string returnUrl = null) { var authResult = await HttpContext.AuthenticateAsync("Temporary"); if (!authResult.Succeeded) { return(RedirectToAction("SignIn")); } //here we use the name identifier of the temporarily signed-in user which resides in principal in auth result var user = await _registerUserService.GetUserById(authResult.Principal.FindFirst(ClaimTypes.NameIdentifier).Value); if (user != null) { return(await SignInUser(user, returnUrl)); } //If none of hte above works,they need to provide the required info. so lets get that now var model = new ProfileModel { DisplayName = authResult.Principal.Identity.Name }; var emailClaim = authResult.Principal.FindFirst(ClaimTypes.Email); if (emailClaim != null) { model.Email = emailClaim.Value; } return(View(model)); }