So I'm trying to implement session handling fully,...
# support-questions-legacy
p
So I'm trying to implement session handling fully, and see the note on the Recipe:
Copy code
Handling of 401 status code and refreshing the session (steps (4) till (8)) happens automatically via our frontend SDK.
However I don't seem to be getting any automatic retry of the api call from step 7. It technically works by catching a 401 error on the api call itself and using
attemptRefreshingSession()
, but it sounds like that should happen automatically
r
Hey @pageler
Are you using axios on the frontend?
p
I’m not, just the standard http client module from angular (angular+fastapi stack)
r
Ah right. We are working on adding interception to httpclient so that automatic refreshing happens. But until then you can try it out by doing
Copy code
npm i git+https://github.com:supertokens/supertokens-website.get#xmlhttprequest-interception
then you no longer need to manually call
attemptRefreshingSession
. Just make your API call and it will do as the docs says - as long as you have called the session.init function somewhere before.
also, note that this feature is still under development (though mostly done). We will be releasing this officially in the next 1 month's time.
p
Ah okay, perfect! Thanks for your help @rp_st
So I've been testing it out and it doesn't seem to have changed behavior. I still just receive a 401 response (with
{"message":"try refresh token"}
, but nothing is happening and I don't see anything in the frontend logs attempting to react to the response.
Maybe I'm misunderstanding how the auto-retry is supposed to be working @rp_st . Is it meant to be for any API call being authorized, or just one to an
/auth
endpoint being handled by the supertokens middleware?
r
It’s meant for any api call
And if you are getting try refresh token, it should auto retry
Can you enable frontend debug logs and show me the output when you make the api call?