【发布时间】:2016-11-02 14:20:36
【问题描述】:
因为有时我将 auth0 与 express 一起使用。但现在我有一个问题。 这就是我的代码的样子:
var passport = require('passport');
var Auth0Strategy = require('passport-auth0');
var strategy = new Auth0Strategy({
domain: '',
clientID: '',
clientSecret: '',
callbackURL: '/loginapi/callback'
}, 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
return done(null, profile);
});
passport.use(strategy);
// This is not a best practice, but we want to keep things simple for now
passport.serializeUser(function (user, done) {
done(null, user);
});
passport.deserializeUser(function (user, done) {
done(null, user);
});
module.exports = strategy;
但是我怎样才能在像用户元素这样的快速请求中访问 accessToken。我真的不知道怎么做,但我已经尝试了一些东西。
尼尔斯
【问题讨论】:
标签: express passport.js auth0