next-auth
next-auth copied to clipboard
JWTEncodeParams maxAge type definition
Question 💬
In the type definition for JWTEncodeParams, maxAge is defined as optional.
export interface JWTEncodeParams {
/** The JWT payload. */
token?: JWT;
/** The secret used to encode the NextAuth.js issued JWT. */
secret: string | Buffer;
/**
* The maximum age of the NextAuth.js issued JWT in seconds.
* @default 30 * 24 * 30 * 60 // 30 days
*/
maxAge?: number; // line being referred to in this issue!
}
Since a default value is always provided by nextauth (30 days), the maxAge field is always defined, making the question mark incorrect. Ran into this while overriding the encode function. Will fix if it is decided that I am correct. Thanks!
How to reproduce ☕️
Look at type definition for JWTEncodeParams
Contributing 🙌🏽
Yes, I am willing to help answer this question in a PR
Since maxAge
is defined internally if missing, it means the user could omit the value, hence it is optional.
Judged quickly, I think you are right, this is the params you receive when overriding the encode
function.
You are correct. A small code snippet might have made it more clear. :+1: ~Feel free to open a PR!~ I found #4901, it just wasn't linked. :sweat_smile:
Judged quickly, I think you are right, this is the params you receive when overriding the
encode
function.You are correct. A small code snippet might have made it more clear. 👍 ~Feel free to open a PR!~ I found #4901, it just wasn't linked. 😅
Sorry, new to all this, appreciate the feedback.
It looks like this issue did not receive any activity for 60 days. It will be closed in 7 days if no further activity occurs. If you think your issue is still relevant, commenting will keep it open. Thanks!
To keep things tidy, we are closing this issue for now. If you think your issue is still relevant, leave a comment and we might reopen it. Thanks!