Technically, jose supports passing timey strings, e.g. '1h', '10days' etc. (here)
This PR updates the type of exp to be string as well as a number for that.
Also, this fixes overriding exp value when calling jwt.sign() method.
Example:
const token = await jwt.sign({
userId: 'qwbfo21b9d',
exp: '1h', // <~ this now works fine. Previously this was ignored and threw a type error
})
I was so confused why my exp field was not being passed into my token; this would be a great QOL feature, and certainly would save others from hours of debugging.
Technically, jose supports passing timey strings, e.g.
'1h'
,'10days'
etc. (here) This PR updates the type ofexp
to bestring
as well as anumber
for that.Also, this fixes overriding
exp
value when callingjwt.sign()
method. Example: