React Auth0 button sometimes doesn't work?

Hey all,

I’m using the auth0 react package. Pretty simple log in flow. Standard stuff.

I have a super odd bug, which is sometimes triggered, and sometimes not. Users will try to click on a button that has the onClick={loginWithRedirect}, and nothing will happen. No console output, nothing to sentry, there is no error at all. The button simply doesn’t do anything. It’s difficult to recreate, as we don’t know what causes it, but it affects a decent amount (5-10% of our users). My suspicion is adblock or antivirus, but sometimes after disabling those, it still occurs.

Below is the code we use:

<AwesomeButton
					type='primary'
					style={{
						"--button-primary-color": "#7c55d6",
						"--button-primary-color-dark": "#6444ad",
						"--button-primary-color-light": "#fff",
						"--button-primary-color-hover": "#6444ad",
						"--button-primary-color-active": "#6444ad",
					}}
					onPress={() =>
						loginWithRedirect({
							screen_hint: "login",
							mode: "login",
						})
					}
				>
					Log in
				</AwesomeButton>
const root = ReactDOM.createRoot(document.getElementById("root"))
root.render(
	<BrowserRouter>
		<Auth0Provider
			domain={process.env.REACT_APP_AUTH0_DOMAIN}
			clientId={process.env.REACT_APP_AUTH0_CLIENT_ID}
			redirectUri={process.env.REACT_APP_REDIRECT_URI}
			audience={process.env.REACT_APP_AUDIENCE}
			scope='read:current_user'
			useRefreshTokens={true}
			cacheLocation='localstorage'
		>
			<App />
			<Toaster />
		</Auth0Provider>
	</BrowserRouter>
)

Anybody faced this problem using React login before?

Frontend service is Vercel, environment variables are definitely set.

Any help at all please?

Hey there!

In order to handle that most effectively can I ask you to raise it as a GitHub issue in the React SDK GitHub repo so we can talk about it directly with the SDK maintainers? Once you have a link to it please share it here so we can ping them. Thank you!

Bug with loginWithRedirect · Issue #524 · auth0/auth0-react · GitHub @konrad.sopala

1 Like

Thanks a lot, I’ll ping the repo maintainers in a few minutes!

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