Automatically getting logout on hard refresh

hey everyone, currently we are building an app with auth0 . but we are facing some issue regarding the auth. when we either reload or change locale, the auth is getting prerise itself. but strangely that behavior is not happening in local server. only in production. what might be the issue on this.
we are using next -intl for internalization, so that the url will be like /en , /bod . is this causing the issue

Hi @tibetdelek

Welcome to the Auth0 Community!

I am currently still investigating the issue that you are running into. I will come back with an update as soon as possible!

Kind Regards,
Nik

Hi again.

As far as I have inspected in your tenant logs, it appears that you receive an Invalid Authorization Code errors after a user successfully authenticates, which I believe you receive after you redirect the user to the appropriate locale or on page refresh.

It appears that your application is trying to re-authenticate the user on page refresh using the same authorization code. As mentioned in our documentation, they are single-use.

In order to prevent this, I would recommend to check the user session by using the checkSession() or getAccessToken() functions.

Alternatively, you can implement refresh tokens for your application so that a refresh token is provided whenever the page is refreshed or the user is redirected to the new URL for internationalization.

If you have any other questions, feel free to let me know. I will come back with additional info if necessary regarding the matter.

Kind Regards,
Nik

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.