Refresh token in Passport.js

前端 未结 2 670
我寻月下人不归
我寻月下人不归 2021-02-13 12:48

How do I do this in Passport.js?:

When the access token expires, you can use the refresh_token to \"refresh\" your access, and gain another access_token

相关标签:
2条回答
  • 2021-02-13 13:26

    answer from Jared Hanson, author PassportJS:

    Refresh tokens are something handled entirely on the backend, and not connected to a user's session. For example: set up a cron job, query for tokens about to expire, make POST requests to refresh them.

    Passport doesn't get involved in this process, because its separate from authentication.

    0 讨论(0)
  • 2021-02-13 13:46

    I asked Jared if he would consider adding something into the core to make this a little easier to handle. He responded by saying that this should not be handled in the core.

    So I wrote a plugin to help: https://github.com/fiznool/passport-oauth2-refresh

    0 讨论(0)
提交回复
热议问题