将gapi.client.request的路径从相对变为绝对

时间:2014-10-26 06:58:21

标签: gapi

我想使用刷新令牌来生成访问令牌。所以我正在制作一个gapi.client.request,如下所示。我想将主机用作'accounts.google.com'(我的实际路径为'https://accounts.google.com/o/oauth2/token'),但请求的路径为'content.googleapis.com/o/oauth2/token'。主要问题是gapi在path参数中使用 relative url ,所以即使我将完整路径放在'path'中,它也会从'content.googleapis开始解释它。 com'后跟'https://accounts.google.com/o/oauth2/token',这显然不是一个有效的网址。那么如何将路径设置为绝对路径而不是相对路径呢?

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();

0 个答案:

没有答案