不允许使用全局 ID.请改用特定于应用程序的 ID [英] The global ID is not allowed. Please use the application specific ID instead

查看:19
本文介绍了不允许使用全局 ID.请改用特定于应用程序的 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在图形 API 2.0 中

In Graph API 2.0

当我使用新的图形 api 访问我的朋友信息时,我收到以下消息.

When I using new graph api to access my friends information, I got the message below.

这里,xxx 是用户 ID.

Here, xxx is an user id.

{
  "error": {
    "message": "The global ID xxx is not allowed. Please use the application specific ID instead.", 
    "type": "OAuthException", 
    "code": 2500
  }
}

什么是特定于应用程序的 ID?至少,文档中没有任何内容.(如果我使用 Graph API 1.0,一切都会好起来的.)

What's application specific ID? At least, there's nothing in the docs about that. (If I use Graph API 1.0, everything will be fine.)

推荐答案

这是 一篇博文我写的关于这个主题的回答你的问题:

Here's an excerpt from a blog post I wrote on this topic that answers your question:

在 v1.0 的简单时代,当 Graph API 报告用户时,它提供的 id 值是该 Facebook 用户的全局 ID 号.这些值是全局的",因为它们可以在客户端应用程序之间共享.在 v2.0 中,/user 端点及其子节点提供的所有用户数据都使用特定于应用程序的 ID.这些 id 不仅是 Facebook 用户的唯一标识符,也是客户端-用户对的唯一标识符.这意味着您不能在应用程序之间共享用户 ID.(尽管 Facebook 确实提供 API 用于在属于单个组织的应用程序之间进行映射.)

In the simpler days of v1.0, when the Graph API reported on a user, the id value it provided was a global id number for that Facebook user. These values were "global" in the sense that they could be shared between client applications. In v2.0, all user data provided by the /user endpoint and its children use application-specific ids. These ids are a unique identifier not just of the Facebook user, but of the client-user pair. This mean that you can’t share user ids between applications. (Though Facebook does provide an API for mapping between applications that are part of single organization.)

这一事实的一个重要后果是,您用于开发的 Facebook 应用程序识别的用户 ID 与您的生产应用程序识别的用户 ID 不匹配.因此,如果您在生产环境中将用户的 Facebook id 存储在您的数据库中,您将无法将该数据库中的用户与开发中 API 返回的数据进行匹配.真烦人!

An important consequence of this fact is that the user ids recognized by the Facebook applications you use for development will not match the ones your production app recognizes. So, if you store your users’ Facebook ids in your database in production, you won’t be able to match up users in that database with data returned from the API in development. That’s annoying!

而且没有办法解决.您只需要从开发应用程序中查询一些朋友,并手动覆盖他们在开发数据库中存储的 Facebook id.这将为您提供一些可供开发的示例.

And there’s no way around it. You’ll just have to query for a few of your friends from the development app and manually overwrite their stored Facebook ids in your development database. This will give you a few exemplars to develop against.

这篇关于不允许使用全局 ID.请改用特定于应用程序的 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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