1

So I am trying to use Passport.js and Node.js to login to Bungie.net. So I used WindowsLive Authentication which works, but what I really want to do is grap the cookies from the callbackURL and come back to my app. Does anyone know how to do this? Passport code below:

passport.use('windowslive', new WindowsLiveStrategy({
  clientID: <my-app-id>,
  clientSecret: <my-secret>,
  callbackURL: "https://www.bungie.net/en/User/SignIn/Xuid"
  },
  function(accessToken, refreshToken, profile, cb) {
    User.findOrCreate({ windowsliveId: profile.id }, function (err, user) {
      return cb(err, user);
    });
  }
));

app.get('/auth/windows', passport.authenticate('windowslive'));

app.get('/auth/windows/callback', passport.authenticate('windowslive', {
  successRedirect: '/success',
  failureRedirect: '/error'
}));

app.get('/success', function(req, res, next) {
  res.send('Successfully logged in.');
});

app.get('/error', function(req, res, next) {
  res.send("Error logging in.");
});

0 Answers0