protected async Task <User> GetCurrentUserAsync() { var id = _userManager.GetUserId(User); if (id == null) { return(await Task.FromResult <User>(null)); } return(await _applicationDbContext.Users .FirstOrDefaultAsync(e => e.Id.Equals(Guid.Parse(id)))); }
public IActionResult LinkLogin(string provider) { // Request a redirect to the external login provider to link a login for the current user var redirectUrl = Url.Action("LinkLoginCallback", "Account"); var properties = _signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl, _userManager.GetUserId(User)); return(Challenge(properties, provider)); }