【问题标题】:Google OpenID & OAuth - How to get access tokensGoogle OpenID 和 OAuth - 如何获取访问令牌
【发布时间】:2011-08-21 01:02:03
【问题描述】:

我有一个网站,我希望用户从该网站链接他们的 GMail 帐户,稍后我希望通过 OAuth 访问用户的 GMail 帐户。我为此使用Google's 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 forward@gmail.com
**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 帐户。通过 OAuth。这是如何运作的?我不需要访问令牌(即 oauth_access_secret 和 oauth_access_token)吗?

我还需要提出更多要求吗?有谁知道这之后该怎么做??

【问题讨论】:

    标签: python oauth access-token google-openid


    【解决方案1】:

    一旦你有了令牌,你必须

    1. 授权,然后
    2. 用它换取访问令牌

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

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

    【讨论】:

      猜你喜欢
      • 2011-09-04
      • 1970-01-01
      • 2012-08-03
      • 1970-01-01
      • 2023-03-27
      • 2011-04-29
      • 2021-09-12
      • 2021-10-12
      • 2012-02-12
      相关资源
      最近更新 更多