Google OAuth 2授权-令牌交换代码
|
我正在尝试实施Google OAuth 2以访问Google API。我使用服务器端方案遵循本指南。
我获取代码没有问题,服务器重定向到本地主机(这是目前重定向URI中允许的唯一服务器)。
为此,我转到
https://accounts.google.com/o/oauth2/auth?client_id=whatever.apps.googleusercontent.com&redirect_uri=http://localhost/&scope=https://www.google.com/m8/feeds/&response_type=code
页面。
然后,我尝试使用curl
(如指南所示)进行测试,以检查Google的服务器是否以访问令牌进行响应。但是,它似乎很难失败。我只能得到response2 response的答复。我确定我已提供Google希望我提供的所有内容-代码,客户端ID,客户端密码,重定向URI(本地主机)和grant_type=authorization_code
。
整个curl
命令行是:
curl https://accounts.google.com/o/oauth2/token -d \"code=<code>&client_id=whatever.apps.googleusercontent.com&client_secret=<won\'t tell!>&redirect_uri=http://localhost&grant_type=authorization_code\"
我想念什么吗?如何交换访问令牌的代码?
没有找到相关结果
已邀请:
3 个回复
扫窟
客户机密和重定向网址?这对我行得通。 应该是
而不是
。
瞧叮
伐教爸