Search code examples
authenticationexpresstokenpassport.jstrello

passportjs, tokenSecret returns an empty object


guys, I'm using passport-trello for user authentication in my App.

export default () => {
  passport.use(new TrelloStrategy({
    consumerKey: process.env.TRELLO_CONSUMER_KEY,
    consumerSecret: process.env.TRELLO_CONSUMER_SECRET,
    callbackURL: 'http://localhost:3000/auth/trello/callback',
    trelloParams: {
      scope: 'read',
      name: 'Common Feed',
      expiration: '1hour'
    }
  }, (req, token, tokenSecret, profile, done) => {
      let user = {};
      user.token = token;
      user.tokenSecret = tokenSecret;
      user.profile = profile;
      done(null, user);
  }));
}

When I'm trying to log out user object it turns out that user.tokenSecret returns an empty object, while other props is filled with corresponding info. I'm wondering if someone had this issue and why it happens to be so. Thank you


Solution

  • I figured out that that req argument is exactly that tokenSecret! Strange behaviour but it is what it is. req return a string, which you can use to access Trello's API. Hope it will help somebody