https://supertokens.com/ logo
do not attempt refreshing with 401
d

DemiSel

04/26/2023, 11:59 AM
Hi ! I'm using the React SDK, calling my API through
fetch
calls. Whenever a request ends up with status 401, I see it being retried after refreshing the session as a consequence of
addFetchInterceptorsAndReturnModifiedFetch
. Do I have some control over this behavior ? There are some cases where I don't want to attempt refreshing the session after a 401 status.
r

rp

04/26/2023, 12:15 PM
hey @DemiSel We recommend that you reserve
401
status code for this use case wherein it does a refresh. If you are using
401
for something else as well and want to keep using
401
for that, you can change the status code for session refreshing to something else other than
401
using the
sessionExpiredStatusCode
config on the frontend and backend SDKs (in session.init).
If i have misunderstood your use case, can you elaborate on it please.
d

DemiSel

04/26/2023, 12:17 PM
Alright thanks for the on-point answer !