簡體   English   中英

Auth0-從服務器獲取令牌

[英]Auth0 - get Token from Server

我正在使用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;

您為什么要保留access_token 用戶認證后您將做什么?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM