JWT Session Storage
The JWT session storage converts sessions to and fromJSON Web Tokens.
Examples
jwtStorage(options): Storage
Creates a that can be used in the sessions middleware.
Arguments
- options:
Object
An object with the following properties:
- algorithm:
string
(Default:"HS512"
)
The algorithm to use for signing the token.
Supported values:
- <code>"HS512"</code> (HMAC-SHA512)
- <code>"none"</code> (no signature)
This field is forbidden when using the “none” algorithm but required otherwise.
- ttl:
number
(Default:3600
)
The maximum lifetime of the token in seconds. You may want to keep thisshort as a new token is generated on every request allowing clients torefresh tokens automatically.
- verify: (Default:
true
)
If set to false
the signature will not be verified but still generated(unless using the “none” algorithm).
- maxExp:
number
(Default:Infinity
)
Largest value that will be accepted in an incoming JWT exp
(expiration) field.