title: External login using Identity Server 3 - Setting Given Name claim from facebook
body: <p>Im trying to setup identityserver to be able to login with facebook. All works fine except I cant retrieve any of the user info from facebook.The mvc app is expected a givenname and lastname claim.  I have added a scope to public_profile but do not get it back. </p>
  
  <p>After lots of research it seems like I might need to setup a UserService to do this but am not sure how to do this.</p>
  
  <p>Help would be greatly appreciated.</p>
  
  <p>Here is my code to configure the external providers in the statup of the idenity server app:  </p>
  
  <pre><code>private void ConfigureIdenityProviders (IAppBuilder app, string signInAsType)
      {
  
          var facebookOptions = new Microsoft.Owin.Security.Facebook.FacebookAuthenticationOptions
          {
              AuthenticationType = "Facebook",
              Caption = "Sign in with Facebook",
              SignInAsAuthenticationType = signInAsType,
              AppId = "xxxxxxxxxxxx",
              AppSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  
  
  
              Provider = new Microsoft.Owin.Security.Facebook.FacebookAuthenticationProvider()
              {
                  OnAuthenticated =  (context) =&gt;
                  {
  
                      // Problem here - there is no last_name returned
                         JToken lastname;
                      if (context.User.TryGetValue("last_name", out lastname))
                      {
                          context.Identity.AddClaim(new System.Security.Claims.Claim(IdentityServer3.Core.Constants.ClaimTypes.FamilyName, lastname.ToString()));
                      }
  
                      context.Identity.AddClaim(new System.Security.Claims.Claim("role", "Guest"));
  
                      return Task.FromResult(0);
  
                  }
  
              }
          };
  
           facebookOptions.Scope.Add("public_profile");
          facebookOptions.Scope.Add("email");
  
  
          app.UseFacebookAuthentication(facebookOptions);
  
      }
  </code></pre>