I have the following problem:
Within method GrantResourceOwnerCredentials
in class OAuthProvider : OAuthAuthorizationServerProvider
I'm filling in custom properties to be returned along with the Token. However, the associated class object UserProfile
always comes null after I use FindAsync
, as shown in the line below:
ApplicationUser user = await userManager.FindAsync(context.UserName, context.Password);
I can add via eager loading the associated object as follows:
await userManager.Users.Include("UserProfile").SingleOrDefaultAsync(u => u.UserName == context.UserName);
ApplicationUser user = await userManager.FindAsync(context.UserName, context.Password);
But I do not think it's correct because I check the username in the bank before checking that it is correct (because of the password).
I wanted to load this object after using FindAsync
, but I do not know how.
How can I do this using user
?