From our docs (Ask AI):
Cookie size issues occur because Descope stores custom claims in the refresh token, and browsers limit cookies to 4KB.
(1)
Limits:
• Each key: max 60 characters
(1)
• Each claim value: max 500 characters
(1)
• Each JWT: max 100 keys
(1)
Solutions:
1.
Reduce custom claims - Avoid storing too much data in JWTs to prevent storage limitations.
(1)
2.
Switch to response body management - Instead of storing tokens in cookies, configure your project to return tokens in the API response body.
(2) This removes the 4KB cookie size constraint.
(2)
3.
Use localStorage - The SDK can store tokens in localStorage instead of cookies by not setting
sessionTokenViaCookie
.
(3)(4)
Note: If your session token stays small (less than 1KB),
sessionTokenViaCookie
works fine.
(3) Session tokens grow when using authorization or adding custom claims.
(4)