Set Express response headers before redirect

后端 未结 1 1451
攒了一身酷
攒了一身酷 2020-12-19 02:36

I\'m implementing a site login that takes in an email/password combo, retrieves an API token, and returns it to the user to get stored (encrypted) in localStorage.

相关标签:
1条回答
  • 2020-12-19 02:44

    Setting headers wouldn't work here because a redirect will execute a new http request, you can use express-session to store the auth token and fetch it when you need it

    req.session.accessToken = token
    
    0 讨论(0)
提交回复
热议问题