我正在尝试使用passwordjs-oauth2从eBay获取授权代码,但是passport不会返回任何数据。
passport-config.js
const passport = require("passport");
const OAuth2Strategy = require("passport-oauth2").Strategy;
var authStrategy = new OAuth2Strategy(
{
authorizationURL: "https://auth.sandbox.ebay.com/oauth2/authorize?",
tokenURL: "https://api.sandbox.ebay.com/identity/v1/oauth2/token",
clientID: "client-id"
},
function(accessToken, refreshToken, params, profile, cb) {
console.log("Here!");
console.log(accessToken);
console.log(refreshToken);
console.log(params);
console.log(profile);
cb(null, profile);
}
);
authStrategy.authorizationParams = function() {
return {
redirect_uri: "redirect-uri",
response_type: "code"
};
};
auth-route.js:
router.get("/", passport.authenticate("ebay"), function(req, res) {
console.log("ebay");
console.log(req.params);
res.redirect("/");
});
但是没有任何控制台日志实际是日志。任何想法如何解决此问题? (代码未到达console.logs)
编辑:URL确实返回了我要获取的代码。
谢谢