Nodejs instagram api post请求authcode,它给出了错误400

卡洛斯懒惰

我正在尝试向 instagram 发送帖子请求以获取访问令牌,但是当我发送它时,我收到 err 400,这意味着语法错误。我是否使用了错误的语法?

const request = require('request');
var formData = {
client_id: "theclientid",
client_secret: "thelcientsecret",
grant_type: "authorization_code",
redirect_uri: "http://localhost:3000/",
code: "thecode"
}
request.post({
    uri: "https://api.instagram.com/oauth/access_token",
    formData: formData,
    json: true
}, function(err, res, body) {
    console.log(err);
    console.log(res.statusCode);
    if (!err && res.statusCode == 200) {
        var user = JSON.parse(body);
        console.log(user);
    }
});
尼古拉·安德烈耶夫

如果您打印响应正文,您将看到问题所在。

{ error_type: 'OAuthException',
  code: 400,
  error_message: 'Invalid Client ID' }

试试另一个client_id

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章