# Login Screen Scope Decline Flow

**URL:** <https://community.auth0.com/t/login-screen-scope-decline-flow/185688>\
**Category:** Get Help\
**Tags:** login-experience, new-universal-login-experience\
**Created:** [April 18, 2025, 6:12pm UTC](https://community.auth0.com/t/login-screen-scope-decline-flow/185688 "2025-04-18T18:12:12Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsdev305](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jsdev305/32/71258_2.png) [@jsdev305](https://community.auth0.com/u/jsdev305)\
**Post date:** [April 18, 2025, 6:12pm UTC](https://community.auth0.com/t/login-screen-scope-decline-flow/185688/1 "2025-04-18T18:12:13Z")

</div>

Hello,  
Recently i have updated to auth0 4.4 , I’m using the Universal Login Process  
I have noticed with the newer versions, we no longer need the /auth/[…auth0]/route.ts

so now its just the /lib/auth0 file

i had a question if the user tries to login , they see the scope how the app will use their data, and click decline

the app crashes

“An error occurred during the authorization flow.”

Where do i handle this logic / would it be inside the /lib/auth0?

Thanks for any help in advance.

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [April 18, 2025, 6:46pm UTC](https://community.auth0.com/t/login-screen-scope-decline-flow/185688/3 "2025-04-18T18:46:21Z")

</div>

Hi @jsdev305

Welcome to the Auth0 Community!

As mentioned in our [documentation](https://auth0.com/docs/authenticate/identity-providers/social-identity-providers/reprompt-permissions), you will need to set the `prompt=consent` parameter when calling the `/authorize` endpoint in order to be prompted again.

If you have any other questions, let me know!

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![jsdev305](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jsdev305/32/71258_2.png) [@jsdev305](https://community.auth0.com/u/jsdev305)\
**Post date:** [April 18, 2025, 7:20pm UTC](https://community.auth0.com/t/login-screen-scope-decline-flow/185688/4 "2025-04-18T19:20:48Z")

</div>

Hello Nik, thank you for the fast response,

but it looks like it did not trigger the login flow.

maybe I’m missing something else?

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [April 18, 2025, 7:25pm UTC](https://community.auth0.com/t/login-screen-scope-decline-flow/185688/5 "2025-04-18T19:25:00Z")

</div>

I see.

Could you let me know what SDK are you using? From what I understand, it is the NextJS SDK?

Is the user not redirected at all to the login or does nothing happen when they decline the prompts specifically?

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![jsdev305](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jsdev305/32/71258_2.png) [@jsdev305](https://community.auth0.com/u/jsdev305)\
**Post date:** [April 18, 2025, 7:29pm UTC](https://community.auth0.com/t/login-screen-scope-decline-flow/185688/6 "2025-04-18T19:29:10Z")

</div>

yes I’m using the auth sdk

“@auth0/nextjs-auth0”: “^4.4.2”,

when the user clicks on decline  
i get redirected to a black screen

The text : An error occured during the authorization flow.

---

<div class="post-metadata">

**Author:** ![jsdev305](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jsdev305/32/71258_2.png) [@jsdev305](https://community.auth0.com/u/jsdev305)\
**Post date:** [April 18, 2025, 7:42pm UTC](https://community.auth0.com/t/login-screen-scope-decline-flow/185688/7 "2025-04-18T19:42:05Z")

</div>

do i need to add something to allowed uri with this prompt consent ?

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [April 18, 2025, 7:53pm UTC](https://community.auth0.com/t/login-screen-scope-decline-flow/185688/8 "2025-04-18T19:53:46Z")

</div>

No, you would not need to change anything regarding Allowed URIs.

By simply adding the parameter when calling the `/authorize` endpoint of the Authorization API. This is mentioned [here](https://auth0.com/docs/authenticate/identity-providers/social-identity-providers/reprompt-permissions).

Otherwise, you can take a look at the code samples provided in the following community posts regarding the same issue:

- [Logging out the user and redirecting them](https://community.auth0.com/t/how-to-handle-access-decline-gracefully-with-auth0-nextjs-auth0/86718)
- [Redirecting user after user consent](https://community.auth0.com/t/how-to-handle-the-decline-authorize-app-in-nextjs/130844/2)
- [Allow user to log in using different address if consent is declined](https://community.auth0.com/t/how-to-select-a-different-email-address-if-user-declines-authorize-app-step-during-sign-up-auth0-nextjs-auth0/86760)

Let me know if these are helpful or not!

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![jsdev305](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jsdev305/32/71258_2.png) [@jsdev305](https://community.auth0.com/u/jsdev305)\
**Post date:** [April 18, 2025, 7:56pm UTC](https://community.auth0.com/t/login-screen-scope-decline-flow/185688/9 "2025-04-18T19:56:26Z")

</div>

So for example , in the root layout of my nextjs

i have this

```auto

export default async function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  const session = await auth0.getSession();

  if (!session?.user) {
    console.log("Not authenticated");
    // Redirect to the login page if the user is not authenticated
    redirect("/auth/login?prompt=consent");
  }

```

is this usually enough to get the reprompt for the login if user clicks on decline while viewing the app’s scope requirements ?

i dont see any other examples with the current version.  
Thanks for the help by the way.

---

<div class="post-metadata">

**Author:** ![jsdev305](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jsdev305/32/71258_2.png) [@jsdev305](https://community.auth0.com/u/jsdev305)\
**Post date:** [April 18, 2025, 8:15pm UTC](https://community.auth0.com/t/login-screen-scope-decline-flow/185688/10 "2025-04-18T20:15:39Z")

</div>

Hey Nik,  
I think i resolved this issue,

hope it helps

```auto
export async function middleware(request: NextRequest) {
  const { pathname, searchParams } = request.nextUrl;

  // Intercept only the /auth/callback path
  if (pathname === "/auth/callback") {
    const error = searchParams.get("error");

    /* case for if the user clicks on decline button
    during the app's scope request
    if access_denied, redirect to login
    */
    if (error === "access_denied") {
      // Redirect user to login again with prompt=consent
      const redirectUrl = new URL("/auth/login", request.url);
      redirectUrl.searchParams.set("prompt", "consent");
      return NextResponse.redirect(redirectUrl);
    }
  }

  // Proceed with Auth0 middleware if not intercepted
  return await auth0.middleware(request);
}

```

this is one of the possible solutions

what do you think ?

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [April 18, 2025, 11:04pm UTC](https://community.auth0.com/t/login-screen-scope-decline-flow/185688/11 "2025-04-18T23:04:23Z")

</div>

Hi!

Usually, the redirect to the login route if the user does not have a session  
( `redirect("/auth/login?prompt=consent");` ) should resolve the issue since you passed in the parameter. If that did not fix the issue, the code you have added appears to be a suitable workaround since it accomplishes the same thing.

If I can help with anything else, let me know!

Kind Regards,  
Nik

---

<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:** [May 2, 2025, 11:05pm UTC](https://community.auth0.com/t/login-screen-scope-decline-flow/185688/12 "2025-05-02T23:05:10Z")

</div>

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