Facebook login responce : Not Get Users details ex

2019-09-11 16:24发布

问题:

Facebook login responce not getting user's all Details like email, firstname, lastname. Its works fine in Facebook Graph API v2.0 but not in v2.4. I am using this plugin for PhoneGap application. this repository from https://github.com/phonegap-build/FacebookConnect

if (response.authResponse) {
      facebookConnectPlugin.api('/me', null,
           function (me_response) {
               var username = me_response.email;
               var firstname = me_response.first_name;
               var lastname = me_response.last_name;
               var ExternalIdentifier = me_response.id;
               var Email = me_response.email;                           
               var ProviderSystemName = "ExternalAuth.Facebook";
               ExternalResponseInsert(apiSecretKey, storeId, languageId, username, firstname, lastname, Email, ExternalIdentifier, OAuthToken, OAuthAccessToken, ProviderSystemName);
                    facebookConnectPlugin.logout(function (response) {}, function (response) {});                            
               });
            } 

回答1:

This is a reference from Stackoverflow Question

Looks like you're using v2.4 of the Graph API. See

  • https://developers.facebook.com/docs/apps/changelog#v2_4

Declarative Fields
To try to improve performance on mobile networks, Nodes and Edges in v2.4 requires that you explicitly request the field(s) you need for your GET requests. For example, GET /me no longer includes likes and comments by default, but GET /me?fields=id,name,username,emails,first_name,last_name will return the data. For more details see the docs on how to request specific fields.