Users are redirected to login page after sign up flow even though I'm using the Universal Login sign up

I have a Next.js project (client side only) where users can sign up via the Universal Login screen, but they’re apparently not being automatically signed in.

After the sign in/sign up flow, users are redirected to the /auth_callback page, that redirects them to an onboarding flow if they still don’t exist in our database or to a to one of the platform pages if they already are registered.

The problem is that, when signing in, it all works properly; but when users sign up, instead of redirecting them to one of these pages, they are logged out and are required to sign in again, even though they should have been signed in automatically after a successful sign up.

The following code block is a context provider, where the redirect logic is placed:

const AuthProvider = ({ children }: PropsWithChildren) => {
	const router = useRouter();
	const { isAuthenticated, getAccessTokenSilently } = useAuth0();

	useEffect(() => {
		if (!isAuthenticated) return;
	}, [isAuthenticated]);

	const handleSignIn = async () => {
		const accessToken = await getAccessTokenSilently();

		try {
			await getLoggedUser();

			if (router.pathname === "/" || router.pathname === "/auth_callback") {
		} catch (error) {
			// The sign up scenario will always end up here
			if (error?.response.status === 404) {

	return <AuthContext.Provider value={{}}>{children}</AuthContext.Provider>;

export default withAuthenticationRequired(AuthProvider);