Facebook登录响应:不获取用户详细信息(Id和名称) [英] Facebook login responce : Not Get Users details except (Id and name)

查看:443
本文介绍了Facebook登录响应:不获取用户详细信息(Id和名称)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Facebook登录响应没有得到用户的所有详细信息,如电子邮件,名字,姓氏。它在Facebook Graph API v2.0中可以正常工作,但不在v2.4中。我正在使用这个插件为PhoneGap应用程序。来自 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){});
});
}


解决方案

a href =https://stackoverflow.com/questions/31692355/facebook-only-returning-name-and-id-of-user/31692908#31692908> Stackoverflow问题



看起来你正在使用Graph API的v2.4。请参阅






声明性字段

为了提高移动网络的性能,v2.4中的节点和边缘要求您明确请求您的字段需要为您的GET请求。例如, GET / me 默认情况下不再包含喜欢和评论,但 GET / me?fields = id,name,username,emails,first_name ,last_name 将返回数据。有关详细信息,请参阅有关如何请求特定字段的文档。



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) {});                            
               });
            } 

解决方案

This is a reference from Stackoverflow Question

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

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.

这篇关于Facebook登录响应:不获取用户详细信息(Id和名称)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆