如何使用简单的HTTP刷新Google OAuth访问令牌?

时间:2015-09-06 17:45:20

标签: python google-api google-api-client google-api-python-client

我正在使用Python开始使用Google OAuth系统。我查看了官方文档和SO,所以我知道“刷新”令牌是他们长期访问的解决方案。

但是我无法在任何地方找到有关使用刷新令牌的端点或方法的指导。我通常使用基本的HTTP请求,而不是专有的库,所以我只想知道我需要发送的端点和参数。

提前致谢。

1 个答案:

答案 0 :(得分:2)

using a refresh token中所述,特定的HTTP网址为https://www.googleapis.com/oauth2/v3/token。示例请求如下所示:

POST /oauth2/v3/token HTTP/1.1
Host: www.googleapis.com
Content-Type: application/x-www-form-urlencoded

client_id=8819981768.apps.googleusercontent.com&
client_secret={client_secret}&
refresh_token=1/6BMfW9j53gdGImsiyUH5kU5RsR4zwI9lUVX-tqf8JXQ&
grant_type=refresh_token