It looks like SuperToken cookies are exceeding the...
# support-questions-legacy
m
It looks like SuperToken cookies are exceeding the permitted limit. I'm getting this error: "Set-Cookie header is ignored in response from url: http://localhost:4000/auth/session/refresh. The combined size of the name and value must be less than or equal to 4096 characters."
r
Yea! thats a browser limitation. What are you adding in the access token payload?
m
I'm adding some
claims
about what the user can access. (Ex.
{repo:'custodian-sample-org/pizza-shop'}
). Should those go somewhere else?
r
ah right. You generally wanna minimise the number of things in the claims as much as possible
p
also, what browser are you using if you don't mind me asking? 🙂
r
That being said, we are working on making it so that lesser space is taken up by the cookies. However that will take sometime.
And if there is no way that you can reduce the amount of info in the access token payload, then consider this demo app which customises supertokens to use custom headers and localstorage instead of cookies -> https://github.com/supertokens/supertokens-auth-react/tree/master/examples/with-localstorage
m
Sorry for the delayed reply - should I consider using session data instead? Is that also subject to the cookie limit, or is it pulled from the DB?
Chrome
SuperTokens is just endlessly looping with errors.
r
Session data pulls it from the db. You could use that if the info is not fetched that often
Hmm. What are the values in the cookie store on the frontend whilst it’s looping like that?
m
Expired auth token.
Why does /auth/signout return 403 at all? Shouldn’t it simply terminate any sessions found.
r
Our api doesn’t return 403. Is something else in your stack doing that? Also, from the above screenshot it seems to return 401 not 403
The only time the signOut api returns 401 is if the session exists, but that access token has expired. If you are calling the signOut api yourself (without our sdk), make sure to call supertokens.init before and also if using axios, to add its interceptors.
m
Why do it that way? It seems better to simply end the session entirely.
In this case I got into a state where the only way to recover was to delete all cookie and local storage.
r
Cause you can’t end the session without having the access token first. And since the access token has expired, you don’t have the access token.
Can you try it again,? Login, delete the sAccessToken in the cookies and the click the sign out button. What happens?
m
I’m not sure I follow. I understand you enforce that requirement, but why not end a session even if the token is expired?
r
1) Cause the browser doesn't send expired access tokens 2) Even if the browser does send it, it's generally a bad idea to do anything based on an expired access token other than tell the client that it's expired. There is a distinction between expired access token vs expired session. An expired access token doesn't imply an expired session. An expired session happens when the refresh token has expired - in that case, the sign out API will not send back a 401.
12 Views