使用refresh_token创建access_token

时间:2019-02-26 16:06:16

标签: refresh-token

我要使用带有此代码的refresh_token创建access_token。

<script>

var client_id = "55227237342xxxxxx.apps.googleusercontent.com";
var client_secret = "-2xxxxxxxxxHB";
var refresh_token= "1/3xxxxxxxxxxx-xxxxxx";
var grant_type = refresh_token;

$.ajax({
    url:"https://www.googleapis.com/oauth2/v4/token",
    method:"POST",
    contentType:"application/x-www-form-urlencoded",
    dataType:"json",
    data:{client_id:client_id, client_secret:client_secret, refresh_token:refresh_token, grant_type:grant_type},
    success:function(data)
    {
        console.log(data);   
    }
});

但是我收到此错误:

  

{错误:“ unsupported_grant_type”,错误说明:“无效   grant_type:“}

任何人都可以帮忙!

0 个答案:

没有答案