Some users getting 431 error due to large JWT cookies, and Unexpected token < in JSON at position 0 on Vercel deployment
I’m encountering issues with authentication in my Next.js application using Next-auth. After deploying to Vercel, some users are unable to sign in, and the network error shows a 431: REQUEST_HEADER_FIELDS_TOO_LARGE
error, indicating that the JWT cookie size is too large.
How do I change the sigin algorithm of JWT token on auth JS
I found this info from the documentation: The JWT issued by Auth.js is encrypted by default, using the A256CBC-HS512 algorithm (JWE). It uses the AUTH_SECRET environment variable or the passed secret propery to derive a suitable encryption key.
How to access JWT token from a returned object from third party intergration using nextauth.js
When we try to access the returned object after third party authentication on nextauth.js, I’m unable to access the other keys which are not defined in the user interface of nextauth. id, email, name and image are only accessible fields. How do I extract other fields like JWT Token?