【发布时间】:2016-06-09 23:40:11
【问题描述】:
我正在使用 Auth0 在服务器上创建和保存用户。
用户登录后,如何在我的应用程序中的任何位置访问有效令牌?
var strategy = new Auth0Strategy({
domain: 'foo.eu.auth0.com',
clientID: 'xxxxxxxxxx',
clientSecret: 'xxxxxxxxx',
callbackURL: '/login'
}, function(accessToken, refreshToken, extraParams, profile, done) {
// accessToken is the token to call Auth0 API (not needed in the most cases)
// extraParams.id_token has the JSON Web Token
// profile has all the information from the user
var id_token = extraParams.id_token;
return done(null, profile, id_token);
});
passport.use(strategy);
passport.serializeUser(function(user, done) {
done(null, user);
});
passport.deserializeUser(function(user, done) {
done(null, user);
});
module.exports = strategy;
【问题讨论】:
标签: javascript node.js auth0