我需要创建从Postman中的Google Analytics API获取数据的请求。我设法用游乐场平台生成了访问令牌,但我需要永久刷新令牌(在游乐场我只能生成24小时令牌(。
我尝试在控制台API中生成令牌:
- 我已经创建了项目
- 在我的项目中添加分析API
- 生成客户端ID和密码
但我不知道使用哪个重定向URL。JSON中生成的默认值是urn:ietf:wg:oauth:2.0:oob","http://localhost
我已经生成了授权码与请求(从浏览器(:
https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/analytics&redirect_uri=http://localhost&response_type=code&client_id=XXXX
当我试图在Postman中用POST请求生成access_token时,发送了这样的密钥:
code:XXXXXX
redirect_uri:urn:ietf:wg:oauth:2.0:oob (also tryed http://localhost)
client_id:YYYYY
client_secret:ZZZZZZ
scope:https://www.googleapis.com/auth/analytics
grant_type:authorization_code
并得到错误
{
"error": "invalid_grant",
"error_description": "Bad Request"
}
我应该如何为邮差设定补助金?你能帮我解决问题并理解我做错了什么吗
我设法解决了我的问题。应该添加redirect_urlhttps://www.getpostman.com/oauth2/callback