Try to fetch Instagram access token with all requi

2019-08-27 00:23发布

问题:

This is the server side code that tried to make a POST request to Instagram to get an access token

app.get('/instagram/json', (req, res) => {
    axios({
        method: 'post',
        url: 'https://api.instagram.com/oauth/access_token',
        data: {
            'client_id': instagramClientId,
            'client_secret': instagramClientSecret,
            'grant_type': 'authorization_code',
            'redirect_uri': 'http://localhost:3000',
            'code': instagramCode
        }
      }).then((response) => {
            console.log(response);
        }).catch((e) => {
              console.log(e);
          });
});

This is the error response I get. It tells me that "client_id" is required despite I clearly have provided it.

 data: 
  { error_type: 'OAuthException',
    code: 400,
    error_message: 'You must provide a client_id' } } }