session cookies being saved as 'next-auth.session-token.0' and 'next-auth.session-token.1'
Unanswered
Sloth bear posted this in #help-forum
Sloth bearOP
Hello, im trying to implement token rotation in next auth 4 and was forced to do it through middelware, i have two types of user, private and dealer, basically througn middleware im updating the next-auth.session-token and it works perfectly, in the dealer however, it dosent, and when i check my cookie, i find it split into two next-auth.session-token.0' and next-auth.session-token.1', any idea why and hot to fix this?
3 Replies
Chub mackerel
Each cookie can store around 4KB of data.
There are two ways to reduce the size of the session:
1. Store less data in the session.
2. Store most of the session data on the backend.
There are two ways to reduce the size of the session:
1. Store less data in the session.
2. Store most of the session data on the backend.
Sloth bearOP
how about i split my updated encoded token into two halfs and saving each half in one of them?
@Sloth bear how about i split my updated encoded token into two halfs and saving each half in one of them?
Chub mackerel
This is what nextAuth actually doing right now