Facebook登录问题无法获取用户的实际Facebook

Facebook登录问题无法获取用户的实际Facebook

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

问题描述

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

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



ios和web //返回的实际用户ID



Android //不返回实际的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之间的区别。



查看详细资料。


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:

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 09:55