我正在尝试使用youtube apis进行一些工作,获取refresh_token的代码如下所示:
import requests
params={"code":"something",
"client_id":"something",
"client_secret":"something",
"access_type":"offline",
"redirect_uri":"https://localhost",
"grant_type":"authorization_code",
}
endpoint="https://www.googleapis.com/oauth2/v4/token"
data=requests.post(endpoint,params)
if data.status_code== 200:
print "data recieved"
print data.content
else:
print data.status_code , "status_code"
print data.content
并且响应json是:
data recieved
{
"access_token": "something",
"token_type": "Bearer",
"expires_in": 3580
}
响应中没有refresh_token,access_type:offline
应该让它返回refresh_token。
我试过了
prompt=consent
在网址中..但仍然没有运气..
任何帮助将不胜感激