Facebook 实时用户更新
当使用 Facebook 实时回调更新用户设置/详细信息时,即使没有永无止境的令牌,您是否也能够访问用户详细信息?
实际上,我们不想要求用户进行离线访问,但仍然希望能够在我们的系统中更新他们的详细信息。是否可以这样做,或者您是否必须要求离线访问,或者将其标记为在用户下次访问时更新?
When using the Facebook real-time callbacks to update user settings/details, are you able to access a users details even without a never ending token?
Realistically, we don't want to have to ask users for offline access, but still want to be able to update their details in our system. Is it possible to do this, or do you have to require offline access, or mark it to be updated whenever the user next visits?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果你想访问公开的数据,你可以简单地这样获取:
https://graph.facebook.com/{User_ID}
如果您希望响应也包含扩展权限您从用户那里收到的,您可以首先获取应用程序的访问令牌,如下所示:
https:// graph.facebook.com/oauth/access_token?client_id={App_ID}&client_secret={App_Secret}&grant_type=client_credentials
上面的 URL 将返回类似以下内容:
access_token={Your_App_Access_Token}
然后您可以包含该访问权限您的图形 API 请求中的令牌如下所示:
https://graph.facebook.com/{User_ID}?access_token={Your_App_Access_Token}
包括您应用的访问令牌将返回附加信息(例如电子邮件,如果您的应用程序有权限)。
奇怪的是,图形 API 仍然不发送用户图片信息,所以如果是用户的图片发生了变化,我需要使用他们的旧 API,如下所示:
https://api.facebook.com/method/users.getInfo?uids={User_ID}&fields=pic_square,pic_big&access_token={Your_App_Access_Token }&format=json
注意:我不相信您实际上需要应用程序的 access_token 来获取用户的 pic_square 和 pic_big,但我还是会发送它。
If you want to access publicly available data, you can simply get it like this:
https://graph.facebook.com/{User_ID}
If you want the response to also include the extended permissions that you received from the user, you can first get your app's access token like this:
https://graph.facebook.com/oauth/access_token?client_id={App_ID}&client_secret={App_Secret}&grant_type=client_credentials
The URL above will return something like:
access_token={Your_App_Access_Token}
You can then include that access token in your graph API request like this:
https://graph.facebook.com/{User_ID}?access_token={Your_App_Access_Token}
Including your app's access token will return additional information (e.g. email, if your app has permission).
Strangely, the graph API still doesn't send user picture information, so if it's the user's picture that changed, I need to use their OLD API like this:
https://api.facebook.com/method/users.getInfo?uids={User_ID}&fields=pic_square,pic_big&access_token={Your_App_Access_Token}&format=json
Note: I don't believe you actually need your app's access_token to fetch a user's pic_square and pic_big, but I'm sending it anyways.
该死!
Dangit!