Auth0Provider redirects back to login when using google

Hello

What I’m trying to do is to add additional field to sign up page, so I’ve decided to customize lock template. After I switched to that template I am always redirected back to login page when logged in via google. It is also happen when I am just switching to Classic experience. So google works only when I’m using New experience.

One more issue is with user returned from useAuth hook. I have another app that is actually using same code except that it has additional callback page where user checked for existence and this user is always undefined.

I’m using react-auth0 and my app wrapped with provider, I also only added additional field and switched logo in the template. All suggested by the doc configs added.

Can you suggest smth ? Maybe I miss any configs ?

Hi @qoikwa,

Thanks for joining the Community!

In order to help recreate your error, could you please answer the following questions:

  • Are you calling loginWithRedirect or loginWithPopup in your code?
  • Are you sending any parameters in the authentication request (for example, loginWithRedirect({prompt: 'login'})?
  • Just to confirm the I understand, is this the behavior you’re seeing?:
    • User clicks login
    • User is redirected to Universal Login page
    • User clicks “Sign in with Google” button
    • User logs into Google and then is redirected back to the Universal Login page instead of the app

Thanks!

No, I don’t use such functions
I don’t even have any button to click
I use withAuthenticationRequired HoC, so user redirected automatically to login page if not authenticated

Behavior that I’m seeing:

  • User opens app (not authenticated)
  • User is redirected to Universal Login page
  • User clicks “Sign in with Google” button
  • User logs into Google, redirected to my app and then immediately is redirected back to the Universal Login page instead of the app

Thank you for clarifying!

It looks like you’re using the default Auth0 developer keys for the Google social connection. The developer keys will work for simple testing, but auth will not persist page refreshes or navigating between pages which I think might be what is happening.

It’s possible that following this guide will remedy the issue: https://auth0.com/docs/connections/social/google#:~:text=The%20Google%20social%20connection%20allows,are%20automatically%20updated%20in%20Auth0.

Please let me know if using your own credentials for the Google connection fixes this behavior. Thanks!

Yeah, the problem was with dev keys
Thank you !

1 Like

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