Giter Site home page Giter Site logo

passport-qq's Issues

TypeError: Cannot set property 'accessToken' of undefined

passport.use(new QQStrategy({
clientID: config.qq.clientID,
clientSecret: config.qq.clientSecret,
callbackURL: config.qq.callbackURL,
passReqToCallback: true
},
function(accessToken, refreshToken, profile, done) {
console.log('refreshToken:');
console.log(refreshToken);
console.log('accessToken:');
console.log(accessToken);
console.log('profile:');
console.log(profile);
var providerData = profile._json;
providerData.accessToken = accessToken;
providerData.refreshToken = refreshToken;
var providerUserProfile = {
firstName: profile.name.givenName,
lastName: profile.name.familyName,
fullName: profile.displayName,
email: profile.emails[0].value,
username: profile.username,
provider: 'qq',
profiderId: profile.id,
providerData: providerData
};
users.saveOAuthUserProfile(req, providerUserProfile, done);
}
));

login callback

passport.use(new qqStrategy({
    clientID: client_id,
    clientSecret: client_secret,
    callbackURL: "http://127.0.0.1:3000/auth/qq/callback"
  },
  function(accessToken, refreshToken, profile, done) {
   // TODO
    User.findOrCreate({ qqId: profile.id }, function (err, user) {
      return done(err, user);
    });
  }
));

什么时候执行TODO 部分

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.