John Mc John Mc - 1 year ago 150
ASP.NET (C#) Question identity 2.0 Facebook public_profile not returning fields

I'm trying to use Facebook as an external login provider with Identity 2.0. I have my Facebook Authentication options in Startup.Auth configured like:

var facebookOptions = new FacebookAuthenticationOptions()
AppId = ConfigurationManager.AppSettings[OneStepCloserTo.Web.Models.Constants.FacebookClientIdKey],
AppSecret = ConfigurationManager.AppSettings[OneStepCloserTo.Web.Models.Constants.FacebookClientSecretKey]


The email scope works because I can see my email address in the claims returned. However, none of the public_profile fields listed here are returned. Does anyone know why this might be the case?

Answer Source

You can't directly get Facebook profile information from claims added through facebookOptions scope. You have to add scopes as you did in your sample and use FacebookClient.

Try using FacebookClient

public async Task<ActionResult> FacebookInfo()
    var claimsforUser = await UserManager.GetClaimsAsync(User.Identity.GetUserId());
    var access_token = claimsforUser.FirstOrDefault(x => x.Type == "FacebookAccessToken").Value;
    var fb = new FacebookClient(access_token);
    dynamic myInfo = fb.Get("/me/friends");
    var friendsList = newList<FacebookViewModel>();
    foreach (dynamic friend in
               Name =,
               ImageURL = @"" + + "/picture?type=large"

    return View(friendsList);

  public class FacebookViewModel
       [Display(Name = "Friend's name")]
       public string Name { get; set; }
       public string ImageURL { get; set; }

Refer to this article

Hope this helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download