谷歌 OpenID 和OAuth - 如何获取访问令牌

发布于 2024-11-05 17:45:44 字数 1626 浏览 5 评论 0原文

我有一个网站,我希望用户链接他们的 GMail 帐户,稍后我希望通过 OAuth 访问用户的 GMail 帐户。我使用 Google 的 OpenID+OAuth(混合协议)为此。

当我遵循上述文档时,我得到以下信息 -

openid.assoc_handle AOQobUfg8E9PvTYX1huZPleVGoSvky57TxLHMzI-Lxd87cDNwLyrutSm
openid.claimed_id   https://www.google.com/accounts/o8/id?id=AItOawlus8fqLMQGgfCCM6pDZGpuNjwQqqYMs4o
openid.ext1.mode    fetch_response
openid.ext1.type.email  http://axschema.org/contact/email
openid.ext1.value.email [email protected]
**openid.ext2.request_token   4/C-VqYG9lRtJBKM9G15I-tFk58rOS**
openid.ext2.scope   https://mail.google.com/
openid.identity https://www.google.com/accounts/o8/id?id=AItOawlus8fqLMQGgfCCM6pDZGpuNjwQqqYMs4o
openid.mode id_res
openid.ns   http://specs.openid.net/auth/2.0
openid.ns.ext1  http://openid.net/srv/ax/1.0
openid.ns.ext2  http://specs.openid.net/extensions/oauth/1.0
openid.op_endpoint  https://www.google.com/accounts/o8/ud
openid.response_nonce   2011-05-07T18:38:37ZOEVDbKdW6d2g9A
openid.return_to    https://mysite.com/gmail_redir/
openid.sig  niD5l9V7cG+LOE2zYjJ6rS0Cdwc=
openid.signed   op_endpoint,claimed_id,identity,return_to,response_nonce,assoc_handle,ns.ext1,ns.ext2,ext1.mode,ext1.type.email,ext1.value.email,ext2.scope,ext2.request_token

我得到 openid.ext2.request_token ,它应该允许我抓取用户 GMail acc。通过 OAuth。这是如何运作的?我不需要访问令牌(即 oauth_access_secret 和 oauth_access_token)吗?

我还需要提出更多要求吗?有人知道之后如何继续吗?

I have a website from where I want users to link their GMail account, I later want access to the users GMail account through OAuth. I use Google's OpenID+OAuth (Hybrid Protocol) for this.

When I follow the above mentioned documentation, I get the following -

openid.assoc_handle AOQobUfg8E9PvTYX1huZPleVGoSvky57TxLHMzI-Lxd87cDNwLyrutSm
openid.claimed_id   https://www.google.com/accounts/o8/id?id=AItOawlus8fqLMQGgfCCM6pDZGpuNjwQqqYMs4o
openid.ext1.mode    fetch_response
openid.ext1.type.email  http://axschema.org/contact/email
openid.ext1.value.email [email protected]
**openid.ext2.request_token   4/C-VqYG9lRtJBKM9G15I-tFk58rOS**
openid.ext2.scope   https://mail.google.com/
openid.identity https://www.google.com/accounts/o8/id?id=AItOawlus8fqLMQGgfCCM6pDZGpuNjwQqqYMs4o
openid.mode id_res
openid.ns   http://specs.openid.net/auth/2.0
openid.ns.ext1  http://openid.net/srv/ax/1.0
openid.ns.ext2  http://specs.openid.net/extensions/oauth/1.0
openid.op_endpoint  https://www.google.com/accounts/o8/ud
openid.response_nonce   2011-05-07T18:38:37ZOEVDbKdW6d2g9A
openid.return_to    https://mysite.com/gmail_redir/
openid.sig  niD5l9V7cG+LOE2zYjJ6rS0Cdwc=
openid.signed   op_endpoint,claimed_id,identity,return_to,response_nonce,assoc_handle,ns.ext1,ns.ext2,ext1.mode,ext1.type.email,ext1.value.email,ext2.scope,ext2.request_token

I get the openid.ext2.request_token which is supposed to allow me to crawl the users GMail acc. through OAuth. How does that work? Don't I need access tokens (i.e. oauth_access_secret and oauth_access_token)??

Do I need to make any more requests? Anyone know how to proceed after this??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

给妤﹃绝世温柔 2024-11-12 17:45:44

拥有令牌后,您必须

  1. 对其进行授权,然后
  2. 将其交换为访问令牌。

请查看 http://code.google.com/apis/accounts/docs/OAuth.html#WorkingOauth

https://developers.google.com/accounts/docs/OAuth2(适用于 OAuth v2)

Once you have a token, you must

  1. authorize it, and then
  2. exchange it for an access token

Take a look at http://code.google.com/apis/accounts/docs/OAuth.html#WorkingOauth

or https://developers.google.com/accounts/docs/OAuth2 (for OAuth v2)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文