我正在使用fetch
从Instagram API检索授权
需要访问令牌以响应请求。
但是,得到了错误:
{"error_type": "OAuthException", "code": 400, "error_message": "You must provide a client_id"}
const url = 'https://api.instagram.com/oauth/access_token';
let fetchData = {
method: 'POST',
body: JSON.stringify({
'client_id': 'xxxxxxxxxxxxxxxxxxxxxxx',
'client_secret': 'xxxxxxxxxxxxxxxxxxxxxxx',
'grant_type': 'authorization_code',
'redirect_uri':'http://localhost:3000/',
'code':'xxxxxxxxxxxxxxxxxxxxx'
})
}
fetch(url, fetchData)
.then((response) => {
console.log(response, "::response")
return response.json();
}).catch((error) => {
console.log(error," :: ERROR");
return error;
});