Google OAuth 2.0不一致的令牌类型?

时间:2013-04-16 14:37:48

标签: oauth-2.0 google-oauth access-token

Google根据OAuth 2.0 specs自己OAuth 2.0 draft表示授权标题应该是:

Authorization: Bearer {access_token}

实际上它适用于 G + API

但是使用 Google Calendar API ,您需要将Bearer更改为OAuth

Authorization: OAuth {access_token}

您可以在Google OAuth 2.0 Playground

中自行尝试

在我敲击键盘几次后,我发现了这一点。

我无法在任何地方找到关于OAuth令牌类型的任何内容。 这是谷歌不了解自己的指导方针和标准的一个例子,还是我错过了什么?

1 个答案:

答案 0 :(得分:2)

由于传统原因支持“授权:OAuth”格式,OAuth 2的早期草稿使用此架构。

在您的代码中,您应该使用“授权:承载”。如果这不起作用,请让我确切地知道您尝试使用的API(确切的URL和参数)。

例如,以下适用于Bearer和OAuth: curl --header“授权:Bearer XXX” “https://www.googleapis.com/calendar/v3/users/me/calendarList