Redirect Back to Google Choose an Account Causes Error

Hi!
I’ve enabled the google-oauth2 social connection for my application and encountered the following problem:

You may have pressed the back button, refreshed during login, opened too many login dialogs, or there is some issue with cookies, since we couldn't find your session. Try logging in again from the application and if the problem persists please contact the administrator.

The way I reproduced it is:

  1. on the social connection page git “Try connection”
  2. choose an account
  3. success page (It works!)
  4. click the back button (browser)
  5. choose the same account

Thanks in advance!

Hi @tzach ,

Thank you for posting this topic on the Auth0 Community!

When users click the back button, they will see the error page since they have finished the authentication process by logging in with the Google connection successfully.

If you expect users to be re-directed to where they were before the authentication, you could try setting up a default login URL.

  1. Tenant Settings → Advanced → Tenant Login URI
  2. OR go to Applications → open an application settings → Application Login URI,
  3. add the Login URL.

With this configuration, clicking the back button will re-direct the user to start a new Login transaction.

To dynamically re-direct users back to where they were before authenticating, there is a process that involves using the state parameter, storing the URL in your app, and re-directing them back to it after authentication. This doc explains the details.

Hope this helps!

Hi @lihua.zhang!

Thanks for your answer.
I’ve configured the tenant login URI but still gets the same error.

My problem is the redirect back to Google OAuth2 account chooser after first successful login.
Sorry if I wasn’t clear enough.

Hi @tzach ,

I tested this in the Chrome Incognito mode and could not repeat this error. I am curious if you can repeat this in the Incognito mode.

Hi @lihua.zhang,

Yep, it’s happening in Incognito mode as well.

Hi @tzach ,

Could you please share your tenant login URI (authorization URL) with us? This is the format of the URL.

Thanks!

This topic was automatically closed after 12 days. New replies are no longer allowed.