使用third_party_id生成Facebook用户图片 [英] Generate Facebook user picture using third_party_id

查看:146
本文介绍了使用third_party_id生成Facebook用户图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我浏览了Facebook的在线文档,但找不到使用用户的第三方ID(third_party_id)字段手动构造Facebook用户的个人资料图片Uri的方法.

I've had a look through Facebook's online documentation and cannot find a way to manually construct a Facebook user's profile picture Uri using the user's third party ID (third_party_id) field.

例如(无效):

https://graph.facebook.com/<FACEBOOK_THIRD_PARTY_ID>/picture?type=square


http://developers.facebook.com/docs/reference/api/user /

third_party_id: 用户的匿名但唯一的标识符;仅在通过字段URL参数特别要求时返回

third_party_id:   An anonymous, but unique identifier for the user; only returned if specifically requested via the fields URL parameter


使用用户的Facebook ID检索其个人资料图片图像Uri可以工作: https://graph.facebook.com/<FACEBOOK_ID>/picture?type=square

Using the user's Facebook ID to retrieve their profile picture image Uri works: https://graph.facebook.com/<FACEBOOK_ID>/picture?type=square

例如(作品):

<img src="https://graph.facebook.com/568916752/picture?type=square" />


使用用户的Facebook用户名检索其个人资料图片图像Uri可以工作: https://graph.facebook.com/<FACEBOOK_USERNAME>/picture?type=square

Using the user's Facebook username to retrieve their profile picture image Uri works: https://graph.facebook.com/<FACEBOOK_USERNAME>/picture?type=square

例如(作品):

<img src="https://graph.facebook.com/brett.scott/picture?type=square" />


最佳实践建议我在数据库中存储用户的third_party_id而不是用户的Facebook ID(id).我不应该将用户的Facebook ID公开给我网站的其他用户.原因?因为一旦用户可以看到另一个用户的个人资料图片Uri(其中包含他们的Facebook ID),他们就可以找到另一个人的个人资料(请参见下面的示例).我敢肯定还有其他原因.

Best practices suggests that I store the user's third_party_id instead of the user's Facebook ID (id) in my database. I shouldn't be publicising a user's Facebook ID to other user's of my website. The reason? Because once a user can see another user's profile picture Uri, which contains their Facebook ID, they can find the other person's profile (see example below). I'm sure there's other reasons too.

加载个人资料照片:

https://graph.facebook.com/brett.scott/picture?type=square-或-

https://graph.facebook.com/568916752/picture?type=square


然后,任何用户都可以加载上述用户的个人资料:


Then any user can load the above user's profile:

http://www.facebook.com/brett.scott-或-

http://www.facebook.com/568916752


我不想使用Facebook Graph来获取每个用户的个人资料图片Uri picture的请求,因为它太慢了.如果页面上有20张Facebook图片,则有20条HTTP请求返回到Facebook的服务器.我的目标是零.

I do not want to make a request using the Facebook Graph to obtain each user's profile picture Uri picture because it's too slow. If there are 20 Facebook pictures on a page, that's 20 HTTP requests back to Facebook's servers. I'm aiming for zero.

还有另一种使用他们的third_party_id获取Facebook用户个人资料图片的方法吗?

Is there another way to obtain a Facebook user's profile picture using their third_party_id or is it a missing feature?

https://graph.facebook.com/<FACEBOOK_THIRD_PARTY_ID>/picture?type=square

例如(为我的应用程序生成的third_party_id):

For example (third_party_id generated for my application):

https://graph.facebook.com/0u0JrPIriHa3fgEDostj7v8dbdo/picture?type=square

推荐答案

第三方ID是唯一但匿名的标识符.它旨在允许广告客户跟踪唯一身份用户.它专门用于解析为Facebook ID.

The Third Party ID is a unique, but anonymous identifier. It is meant to allow an advertiser to track unique users. It is specifically designed to NOT be resolvable to a Facebook ID.

对于您的网站,只要将数据保密,您就可以将Facebook用户ID存储在数据库中而不会违反TOS.

For your site, you can store Facebook user ids in your database without violating the TOS, so long as you keep that data private.

当您从Graph API请求照片时,Facebook将向该照片返回CDN URL.您可以发布该URL.您不应将这些数据存储的时间比缓存中存储数据的时间长.

When you request a photo from the Graph API, Facebook returns a CDN URL to the photo. You can publish that URL. You aren't supposed to store this data for longer than would be expected in a cache.

要在一个呼叫中获取20张图片,您可以呼叫端点:

To get 20 pictures in one call, you can call the endpoint:

https://graph.facebook.com/picture?type=square&ids=UID_1,USERNAME_2,...UID_n

这篇关于使用third_party_id生成Facebook用户图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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