Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method for updating JWT #260

Mangatt opened this Issue Aug 2, 2016 · 2 comments


None yet
2 participants
Copy link

Mangatt commented Aug 2, 2016

it would be great if server could issue new token with new data - new expiration or session-like data. Now i couldn't do either, token have to expire by itself and then can be issued and session-like data can be saved in connection object, but are lost after connection and reconnection.


This comment has been minimized.

Copy link

ekryski commented Aug 4, 2016

@Mangatt You can always make a request using a valid token and it will return a new one, albeit with the same data and expiration, unless you setup a before hook on the auth/token service to alter the JWT payload.

We have some fixes coming in the 0.8 branch that will make it easier to issue tokens with different options and different payloads.

@ekryski ekryski modified the milestone: 0.8 Aug 9, 2016


This comment has been minimized.

Copy link

ekryski commented Nov 21, 2016

With the new 1.0.0 version of auth you can create a new JWT at any time by calling:

const options = app.get('auth');
app.passport.createJWT(payload, options)

or providing whatever custom JWT options you would like:

const options = {
  secret: 'your secret',
  jwt: {
   // your custom options. See
app.passport.createJWT(payload, options)

So it is entirely up to you when you would like to do it.

@ekryski ekryski closed this Nov 21, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.