简体   繁体   English

从Facebook检索用户登录名-无需登录

[英]Retrieving user login name from facebook - without login

I have a website and I would like retrieve a login name from facebook but without a user authentification in facebook using facebook application. 我有一个网站,我想从Facebook检索登录名,但没有使用Facebook应用程序在Facebook中进行用户身份验证。 Is it possible? 可能吗?

I've tried this: http://graph.facebook.com/me 我已经尝试过: http://graph.facebook.com/me : http://graph.facebook.com/me

This url needs an access token. 该网址需要访问令牌。

I can see this plugin from facebook - PLUGIN - If I've tried this plugin on my website then i needn't to login on facebook and I can see my login name. 我可以从facebook看到这个插件- 插件 -如果我在我的网站上尝试过该插件,那么我就不需要登录Facebook,并且可以看到我的登录名。 Is it possible to do using javascript or in server side (ASP.NET C#) in custome solution on my website? 是否可以在我的网站上的自定义解决方案中使用JavaScript或在服务器端(ASP.NET C#)中进行操作?

if you have the ID of the facebook user then you can retrieve any of the public displayed things with facebook graph. 如果您具有facebook用户的ID,则可以使用facebook图形检索任何公开显示的内容。 So he isn't really trying to access the facebook account just retrieve the usernames. 因此,他并不是真正地尝试访问Facebook帐户,只是检索用户名。

try something like this if the fields are public then you should be able to see them.
graph.facebook.com/<<ID>>?fields=id,name,username

I believe you can do this using an app access token (ie no user login required). 我相信您可以使用应用访问令牌(即无需用户登录)来执行此操作。 Using the Facebook php sdk an app access token can be generated as follows: 使用Facebook php sdk,可以按以下方式生成应用访问令牌:

require 'libs/fb/facebook.php'; 需要'libs / fb / facebook.php';

$facebook = new Facebook(array(
  'appId'  => '{app_id}',
  'secret' => '{app_secret}',
));

$access_token = $facebook->getAccessToken();

echo $access_token;

User information can them be obtained using the following REST url: 可以使用以下REST URL获得用户信息:

https://graph.facebook.com/554718794?fields=id,name,username&access_token={app_access_token}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM