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

**URL:** <https://community.auth0.com/t/nextjs-app-after-failed-silent-login-auth0-doesnt-redirect-me-to-the-correct-universal-sign-in-page/136459>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [June 16, 2024, 8:10pm UTC](https://community.auth0.com/t/nextjs-app-after-failed-silent-login-auth0-doesnt-redirect-me-to-the-correct-universal-sign-in-page/136459 "2024-06-16T20:10:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabor.ottlik.hun](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gabor.ottlik.hun/32/57175_2.png) [@gabor.ottlik.hun](https://community.auth0.com/u/gabor.ottlik.hun)\
**Post date:** [June 16, 2024, 8:10pm UTC](https://community.auth0.com/t/nextjs-app-after-failed-silent-login-auth0-doesnt-redirect-me-to-the-correct-universal-sign-in-page/136459/1 "2024-06-16T20:10:19Z")

</div>

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:

http://aggregate\_quail.localhost:3001/api/auth/callback?error=login\_required&error\_description=Login%20required&state=someLongKey

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,  
Gabor

---

<div class="post-metadata">

**Author:** ![marcelina.barycka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcelina.barycka/32/56162_2.png) [@marcelina.barycka](https://community.auth0.com/u/marcelina.barycka)\
**Post date:** [June 18, 2024, 12:07pm UTC](https://community.auth0.com/t/nextjs-app-after-failed-silent-login-auth0-doesnt-redirect-me-to-the-correct-universal-sign-in-page/136459/2 "2024-06-18T12:07:18Z")

</div>

Hi there @gabor.ottlik.hun ,

Thank you for the context 🙂

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?

---

<div class="post-metadata">

**Author:** ![gabor.ottlik.hun](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gabor.ottlik.hun/32/57175_2.png) [@gabor.ottlik.hun](https://community.auth0.com/u/gabor.ottlik.hun)\
**Post date:** [June 18, 2024, 3:02pm UTC](https://community.auth0.com/t/nextjs-app-after-failed-silent-login-auth0-doesnt-redirect-me-to-the-correct-universal-sign-in-page/136459/5 "2024-06-18T15:02:39Z")

</div>

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:

> **[Configure Silent Authentication](https://auth0.com/docs/authenticate/login/configure-silent-authentication#error-responses)**
>
> Learn how to keep users logged in to your application using silent authentication.

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.

```auto
		'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.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [July 2, 2024, 3:03pm UTC](https://community.auth0.com/t/nextjs-app-after-failed-silent-login-auth0-doesnt-redirect-me-to-the-correct-universal-sign-in-page/136459/6 "2024-07-02T15:03:18Z")

</div>

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