Facebook登录问题无法获取用户的实际Facebook ID [英] Facebook login issue unable to get user's actual facebook id

查看:411
本文介绍了Facebook登录问题无法获取用户的实际Facebook ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个应用程序在Android,ios和web。该应用程序使用Facebook登录(使用 easyfacebook.jar )作为授权用户的替代方式。这是正常工作,但由于最近的Facebook sdk的变化,我无法获得实际的Facebook id作为facebook api返回应用程序特定的用户标识。从 Facebook 页面:


从v1.0到v2.0的更改



应用范围的用户ID:为了更好地保护人们的信息,当
人登录您的应用程序的版本已升级为使用
Graph API v2.0,Facebook现在将发布一个应用范围的ID,而不是
该人的原始ID。但是,对于以前
登录到您的应用程序的用户,用户ID不会更改。


我的id对于ios,web和android来说,我有所不同。请看看:



ios和web https://www.facebook.com/559709594 //返回的实际用户ID



Android https://www.facebook.com/10152580446094595 //不返回实际的userId



我试过官方的Facebook sdk来获取实际的用户ID,但是没有成功。我试图通过以下方式获取用户ID:

  user = graphApi.getMyAccountInfo(); 
facebookIdLogin = user.getId();
//返回特定于应用程序的id不是实际的用户id id = 10152580446094595
Log.d(username is:,user.getName()); //返回实际值
Log.d (facebook id is this,facebookIdLogin);
Log.d(facebook user link,user.getLink());
//返回www.facebook.com/10152580446094595

有没有办法让我获取实际的userId。由于平台之间的同步,我需要实际的userId。无论我做什么,我只得到应用程序特定的userId。以下是我要求的权限:

  String permissions [] = {public_profile,user_friends,email}; 

非常感谢任何帮助。

解决方案

您所看到的是与Graph API v2.0引入的应用范围的user_id与全局user_id之间的区别。



查看 https://developers.facebook .com / docs / apps / upgrades#upgrade_v2_0_user_ids 详细资料。


We have an app available in android, ios and web. The app uses facebook login(using easyfacebook.jar) as alternate way of authorizing users. It was working fine but due to recent changes in facebook sdk I am unable to get the actual facebook id as the facebook api returns app-specific user id. From the facebook page:

Changes from v1.0 to v2.0

App-scoped User IDs: To better protect people's information, when people log into a version of your app that has been upgraded to use Graph API v2.0, Facebook will now issue an app-scoped ID rather than that person's orginal ID. However, for users that have previously logged into your app, the user ID will not change.

The id that I am getting are different for ios, web and android. Please take a look:

ios and web https://www.facebook.com/559709594 //return's actual userID

Android https://www.facebook.com/10152580446094595 //not returning actual userId

I tried the official facebook sdk to get the actual user id but it was not successful. I am trying to get user id using the following way:

user = graphApi.getMyAccountInfo();
            facebookIdLogin = user.getId();
            //returns app specific id not actual user id id = 10152580446094595 
            Log.d("username is : ", user.getName());//return actual value
            Log.d("facebook id is this", facebookIdLogin);
            Log.d("facebook user link", user.getLink());
            //returns www.facebook.com/10152580446094595 

Is there any way for me to get the actual userId. I need the actual userId because of synchronization between the platforms. Whatever I do I am only getting the app specific userId. Here's the permission I am requesting:

String permissions[] = { "public_profile", "user_friends", "email" };

Any help is highly appreciated.

解决方案

What you're seeing is the difference between an app-scoped user_id which was introduced with the Graph API v2.0, and the global user_id.

Have a look at https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids for the details.

这篇关于Facebook登录问题无法获取用户的实际Facebook ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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