在认证应用程序之前获取Facebook用户的个人资料图片 [英] Get Facebook user's profile picture prior to authenticating app

查看:137
本文介绍了在认证应用程序之前获取Facebook用户的个人资料图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

摘要:

我正在通过Graph API连接到Facebook的网站上工作。被问及我是否可以获得用户的个人资料图片,如果他们已经登录到Facebook,但在用户认证该应用程序之前。这是可能的吗?

I am working on a website that connects to Facebook through the Graph API. I was asked whether I can get a user's profile picture if they are already logged into Facebook, but prior to the user authenticating the app. Is this possible?

编辑:
我知道你可以通过转到 http获得人们的个人资料图片://graph.facebook.com/USERNAME_OR_USERID/picture?type = large ,但是如果他们登录到Facebook,但是没有授权我的应用程序,我可以获得用户的用户名或ID吗?

I know you can get people's profile picture by going to http://graph.facebook.com/USERNAME_OR_USERID/picture?type=large, but would I be able to get a user's username or ID if they are logged into Facebook, but have not authorized my app?

详细信息:

根据 Facebook API用户文档,您可以在没有access_token,我知道如果你直接访问用户的/我的URL,你可以看到他们的基本信息。使用Facebook ID,我可以抓住他们的个人资料图片。

According to the Facebook API User documentation, you can get their Facebook ID without an access_token, and I know if you go directly to a user's /me URL you can see their basic information. With the Facebook ID, I can grab their profile pic.

但是,当我尝试使用以下代码从网站调用它时,我得到一个OAuthException错误。 / p>

However, when I try to call it from the website using the following code, I get an OAuthException error.

FB.api('/me', function(response) {
    console.log(response);
});

我猜想他们必须验证应用程序,但我正在看看我是否可能会错过一个获取他们的个人资料图片的方式。

I'm guessing that they have to authenticate the app, but I'm looking to see if I may have missed a way of getting their profile pic.

感谢您的帮助!

推荐答案

您可以无需身份验证即可获取所有人的Facebook个人资料。

You can get everyone's Facebook profile picture without authentication.

您只需调用 http://graph.facebook.com/USERID/picture?type=large
此URL将重定向到图像URL。

You just call http://graph.facebook.com/USERID/picture?type=large. This URL redirects you to image URL.

编辑:不允许用户名查询,所以我更新了 USERNAME_OR_USERID as USERID

Querying by username is not allowed anymore, so I updated USERNAME_OR_USERID as USERID.

这篇关于在认证应用程序之前获取Facebook用户的个人资料图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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