2016-05-30 146 views
0

我使用Auth0在服务器上创建并保存用户。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; 

回答

0

为什么要保留access_token?用户认证后你会做什么?