Why (Refresh Auth Workflow) not getting triggered when API responds with 401/403?

can you please share with me the app you created and tested it? so I can see if I can catch something I am missing in my app?

okay, please keep me updated

I just copied your auth setup from the screenshot you shared so there isn't anything you are missing in your set up.

My hunch is that the issue is on the supertokens side of things with how it is handling the auth tokens that are in the cookies of the request.

Could you try updating their "test login url" to use supertoken's /example endpoint, which seems designed to test auth sessions.

Also could you enable the refresh auth trigger again and set to time-based expiry, and set equal to whatever their access_token_validity config value is.

If you could share a screen recording of this that would be very useful! :raising_hands:

Hi @Jack_T

Re 1) ok, nice that my setup seems good.
Re 2) Supertokens requires (sAccessToken, sRefreshToken) as cookies to refresh the session with new tokens ofc, our current issue is that Retool isn’t triggering the Refresh Auth workflow when the API responds with 403/401 and even when we set timer to refresh it, it doesn’t get trigger too
Re 3) Supertokens don’t have an endpoint that we can use in ‘test login url‘ and the URL I set is doing it’s job as expected
Re 4) I already did and currently this is what I am doing

FYI:

  • I added vars as duplicate submit for cookies to make sure they are there in every request, and still the same issue.
  • I added a manual refresh and if the token expires and we refresh manually it removes the tokens (access, refresh) from the browser cookies!!!

Hi @CoderNadir,

Thank you for the details.

We can't seem to figure out why the refresh is not being triggered.

Are you able to provision another user(us at Retool) on your Supertokens account so that we can better try to reproduce this with Supertokens?

Would it be possible for you to come to our office hours so we can live debug the resource with you to see if we can either solve this or get a better handle on if a bug is preventing the expected flows to occur? If we can get a recording of your resource set up and show that the tokens are being wiped then we can show to our engineers to try to triage why this isn't working as expected :thinking:

Hi @Jack_T I am faaar away from you guys :sweat_smile: I cannot come to your office!

The office hours are on Zoom!

If you click the link it will have instructions on joining remotely :sweat_smile:

Oh :sweat_smile: sorry, Okay I registered a meeting tomorrow

1 Like