Hi guys, I have a custom endpoint that updates JWT...
# support-questions-legacy
v
Hi guys, I have a custom endpoint that updates JWT token payload. It returns new cookie for cookie-based clients and new headers for header based. For cookie-based clients it works out of the box (well, it's just a set-cookie). What to do with header-based clients? How to tell supertokens (react / react-native) SDK to "update your token to this one"? Tnx!
r
hey @vyobukhov it should work for header based as well on its own as long as: - our network interceptors are running on the frontend - The response headers have
st-access-token
and
front-token
- Right values for access control expose headers
v
Yeah, thx, I see that there is a saveTokensFromHeaders fn. Will try to find out why it doesn't work for me properly (fn get's called)
r
hmm ok.
v
ok, it works but uses stale token for new requests. Trying to find the issue...
r
hmm. that's odd. Are the tokens in the browser storage being updated? (They are stored in frontend cookies)
v
I have a react-native client. (Browser clients use cookie-mode, so no issues there). Checking
I just a had a race condition in a code. Problem resolved, thx!
3 Views