您好我正在使用刷新令牌生成令牌,它正在使用ajax调用正常工作,但现在我必须使用相同的代码进行react-native但我收到invalid_grant_type错误,我的代码如下:
fetch('https://www.googleapis.com/oauth2/v3/token', {
method: 'POST',
timeout: 30000,
headers: {
'Accept': 'application/json;application/x-www-form-urlencoded',
'Content-Type': 'application/x-www-form-urlencoded;application/json'
},
body: JSON.stringify({
client_id: this.client_id,
client_secret: this.secret,
refresh_token: globalRefreshAccessToken,
grant_type: 'refresh_token'
})
}).then((response) => response.json())
.then((responseData) => {
console.log(JSON.stringify({
client_id: this.client_id,
client_secret: this.secret,
refresh_token: globalRefreshAccessToken,
grant_type: 'refresh_token'
}));
debugger;
// callback(responseData);
})
.catch((error) => {
debugger;
console.log(error)
// errorcallback(error);
});