I am using the passport-bnet strategy and am getting the callback uri mismatch error. In the battle.net Manage Client page I have my redirect url’s as follows.
http://localhost:8080/auth/bnet/callback/
In the passport config I have
module.exports = function (passport) {
passport.use(new BnetStrategy({
clientID: process.env.BNET_ID,
clientSecret: process.env.BNET_SECRET,
callBackURL: `http://localhost:8080/auth/bnet/callback/`,
scope: ['wow.profile'],
passReqToCallback: true
}, {
function(accessToken, refreshToken, profile, done) {
console.log(`################### hit passport ################### ${accessToken}`);
console.log(profile);
return done(null, profile);
}
}));
passport.serializeUser((user, done) => {
done(null, user.id);
});
passport.deserializeUser( (id, done) => {
User.findById(id, function (err, user) {
console.log(user);
done(err, user);
});
});
}
In the route I have
router.get('/bnet', passport.authenticate('bnet'));
router.get('/bnet/callback', passport.authenticate('bnet',
{failureRedirect: '/passport-failure'}), (req, res) => {
console.log("########################### hit auth");
});
When I trigger the route I get
TokenError: Redirect URI mismatch.
at Strategy.OAuth2Strategy.parseErrorResponse (F:\www\unadyne\node_modules\passport-oauth2\lib\strategy.js:358:12)
at Strategy.OAuth2Strategy._createOAuthError (F:\www\unadyne\node_modules\passport-oauth2\lib\strategy.js:405:16)
at F:\www\unadyne\node_modules\passport-oauth2\lib\strategy.js:175:45
at F:\www\unadyne\node_modules\oauth\lib\oauth2.js:191:18
at passBackControl (F:\www\unadyne\node_modules\oauth\lib\oauth2.js:132:9)
at IncomingMessage.<anonymous> (F:\www\unadyne\node_modules\oauth\lib\oauth2.js:157:7)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (internal/streams/readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
Is it because I am not using ssl?