2

我正在使用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;
        });
4

0 回答 0