Reputation: 1847
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. To use the refresh_token you need to do a POST request to our token-endpoint with the grant_type set to refresh_token:
https://podio.com/oauth/token?grant_type=refresh_token&client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&refresh_token=REFRESH_TOKEN
Upvotes: 23
Views: 33334
Reputation: 8037
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
Upvotes: 25
Reputation: 1847
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.
Upvotes: 13