I am trying to get a steam user avatar, after he logs in with OpenID. But I don't know how to retrieve the database user right after login (to add the avater to the database manually)
I added the new attribute to the Application User:
// Add profile data for application users by adding properties to the ApplicationUser class
public class ApplicationUser : IdentityUser
{
public string AvatarPath { get; set; }
}
I created a new Migration and updated the DB. I am trying to alter the data for the user, right after login, but how do I retrieve the current user?!
AccountController:
// Sign in the user with this external login provider if the user already has a login.
var result = await _signInManager.ExternalLoginSignInAsync(info.LoginProvider, info.ProviderKey, isPersistent: false);
if (result.Succeeded)
{
//Get Steam User
if(info.LoginProvider.ToLower() == "steam")
{
//I need the DB User
}
_logger.LogInformation(5, "User logged in with {Name} provider.", info.LoginProvider);
return RedirectToLocal(returnUrl);
}
I tried this:
ApplicationUser u = await GetCurrentUserAsync();
u is null