NextJs app after failed silent-login Auth0 doesn't redirect me to the correct universal sign in page

I have an application on localhost:3000 which does the sign up/in process. The user can do its job and once it’s done he gets redirected to xyz.localhost:3001 where his work can be previewed.
It all working well but I’m preparing my app for edge cases. So I logged out of localhost:3000 and cleared site data from the Chrome dev tool Application tab. And after refresh the silent login kicks in but it fails because I logged out of localhost:3000 and the session layer is gone. Unfortunately silent-login redirects me to the following url:


and got back the following error:
Callback handler failed. CAUSE: login_required (Login required)

As I read upon the topic is should redirect me to Universal Login but it doesn’t.
Can someone help me how to fix this edge case?

Auth0 version
@auth0/nextjs-auth0”: “^3.5.0”,

Kind regards,

Hi there @gabor.ottlik.hun ,

Thank you for the context :slight_smile:

If you repeat all the test steps you described but without clearing website cookies after logging out, how does silent authentication behave? Where the user is redirected?

Apparently nothing different happens, still see the same content after logging out of localhost:3000 and refresh at subdomain.localhost:3001

So in the meantime I come across this page:

Where it suggests to redirect to the login page without the prompt=none parameter.
And this is the bit I’m struggling with. I tried many thing without success.

After some try and fail I’ve got it right.

The following works in both scenario.

		'silent-login': auth0.handleLogin({
			authorizationParams: {
				prompt: 'none',
				redirect_uri: 'http://aggregate_quail.localhost:3001/api/auth/login',
  1. Login into localhost:3000 redirect to subdomain.localhost:3001 and successfully access to the content without directly loging in.
  2. Log out of localhost:3000 clear site data/cookies of subdomain.localhost:3001 then it redirect to the Universal Login page.

One thing to note, you have to record http://aggregate_quail.localhost:3001/api/auth/login as Allowed Callback Urls in the Auth0 app.

1 Like

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