I've implemented the basic facebook loggin as described in the docs. It works very well. But one thing I can't get and is a major issue is that I can't get the first and lastname or the email for the user when he register with facebook. The tutorial says nothing on how to get this. In fact after registering the user is asked to supply their email manually. I don't want them to also need to supply their name here because that would defeat the purpose. Reading the commentsection the original poster says it is possible to retrieve this info from the call with the signinmanager in the ExternalLoginCallback method (by enumerating the info.Principal.Claims enumerable):
var info = await _signInManager.GetExternalLoginInfoAsync();
But I can't seem to get any info from it. If I do it like this:
string firstName; foreach (var item in info.Principal.Claims) { firstName = item. // there are no userinfo fields exposed in this list }
Reading the facebook docs for this login, there should be no need to send the app to review for this basic information. I've activated the app also.
What am I doing wrong here? do i need to further enumerate the item object? I see it has a dictionary called properties. But to enumerate that further seems not very elegant to me and i wouldn't know how to do it. I just want to use their name and email to set the ApplicationUser class at the same time they register with the facebook login.