带有变量定义的函数的invalid_request

时间:2016-12-06 01:59:51

标签: javascript node.js

我正在尝试使用this node library在我的应用中集成mercadolibre。 但我收到此错误消息:

null { message: 'The following parameters are required: client_id,client_secret,grant_type,code,redirect_uri,caller.admin. Empty parameter redirect_uri',
  error: 'invalid_request',
  status: 400,
  cause: [] }

这是我的代码:

exports.authorize = function(req, res, next) {

    var meli = require('mercadolibre');

    var meliObject = new meli.Meli(process.env.MERCADOLIBRE_CLIENT_ID, process.env.MERCADOLIBRE_SECRET);

    var code = req.query.code;
    console.log('code');
    console.log(code);

    redirect_uri = 'https://example.com/dashboard';

    meliObject.authorize(code, redirect_uri, 
        function(err, response){ 

            console.log(err, response);
            res.redirect('/dashboard');

        }) 


};

我该如何解决这个问题?

0 个答案:

没有答案