My app uses social login providers (facebook and linkedin) and asp.net Identity for membership.
The below code creates the user
IdentityUser user = new IdentityUser(username);
IdentityResult identityResult = await _repo.CreateAsync(user);
I should then expect to be able to find the user with the following call
IdentityUser user = await _repo.FindAsync(new UserLoginInfo(provider,username));
However, this constantly returns no user. The user is indeed created in the table AspNetUsers with the correct username. I expect the issue is related to the fact that I don't actually tell the Create method that it's an identity specific to that provider, but I don't know where or how to find the information.
I have searched Microsoft's documentation and cannot find a more proper way of making this call. I've search tutorials on this subject and everywhere seems to be doing it exactly as I am.
1) When creating a user without a password using CreateAsync, how can I then find that user using FindAsync based on social provider?
Gotta love posting a question up here and finding the answer minutes later...
Just had to add a call to AddLogin and everything works perfectly now
_repo.AddLoginAsync(user.Id, userLoginInfo);