我想使用刷新令牌来生成访问令牌。所以我正在制作一个 gapi.client.request,如下所示。我想将主机用作“accounts.google.com”(我的实际路径是“ https://accounts.google.com/o/oauth2/token ”),但请求是通过路径“content.googleapis.com/”发送的o/oauth2/令牌'。主要问题是 gapi 在路径参数中使用相对url,所以即使我将完整路径放在“路径”中,它也会以“content.googleapis.com”开头,然后是“ https://accounts.google.com ” /o/oauth2/token ' 这显然不是一个有效的 url。那么如何将路径设置为绝对路径而不是相对路径?
gapi.client.request({
'path':'/o/oauth2/token',
'method':'POST',
'params':{'rerfresh_token':refreshToken,'client_id':clientId,'client_secret':clientSecret,'grant_type':'refresh_token'}
});
request.execute();