/ / Auth0 - pobierz Token z serwera - javascript, node.js, auth0

Auth0 - pobierz Token z Serwera - javascript, node.js, auth0

Używam Auth0, aby utworzyć i zapisać użytkownika na serwerze.

Jak mogę uzyskać dostęp do ważnego tokena w dowolnym miejscu w mojej aplikacji po zalogowaniu użytkownika?

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;

Odpowiedzi:

0 dla odpowiedzi № 1

Dlaczego chcesz zachować access_token ? Co będziesz robić po uwierzytelnieniu użytkownika?