# Next app deployed on vercel - \[CallbackHandlerError\]: Callback handler failed. CAUSE: access\_denied (Unauthorized)

**URL:** <https://community.auth0.com/t/next-app-deployed-on-vercel-callbackhandlererror-callback-handler-failed-cause-access-denied-unauthorized/140847>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [August 11, 2024, 4:48pm UTC](https://community.auth0.com/t/next-app-deployed-on-vercel-callbackhandlererror-callback-handler-failed-cause-access-denied-unauthorized/140847 "2024-08-11T16:48:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bryso](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bryso/32/59788_2.png) [@bryso](https://community.auth0.com/u/bryso)\
**Post date:** [August 11, 2024, 4:48pm UTC](https://community.auth0.com/t/next-app-deployed-on-vercel-callbackhandlererror-callback-handler-failed-cause-access-denied-unauthorized/140847/1 "2024-08-11T16:48:41Z")

</div>

I recently deployed my Next app-router app to Vercel. For some reason, I get an error returned in the auth callback. It works fine locally. I tried logging into an existing account and creating a new one, both fail.

I’ve been following the instructions here:

> **[Next.js Authentication By Example: Using App Router](https://developer.auth0.com/resources/guides/web-app/nextjs/basic-authentication)**
>
> Learn how to add authentication features to Next.js apps: add login, logout, and sign-up. Learn how to integrate Auth0 with the Next.js App Router to protect Next.js pages and how to call protected APIs.

```auto
a [CallbackHandlerError]: Callback handler failed. CAUSE: access_denied (Unauthorized)
    at /var/task/.next/server/chunks/99.js:1:39181
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /var/task/.next/server/chunks/99.js:1:36639
    ... 4 lines matching cause stack trace ...
    at async en.responseCache.get.routeKind (/var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js:17:1026)
    at async r6.renderToResponseWithComponentsImpl (/var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js:17:508)
    at async r6.renderPageComponent (/var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js:17:5121) {
  code: 'ERR_CALLBACK_HANDLER_FAILURE',
  cause: o [Error]: access_denied (Unauthorized)
      at h.callback (/var/task/.next/server/chunks/99.js:1:3769)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async /var/task/.next/server/chunks/99.js:1:13387
      at async /var/task/.next/server/chunks/99.js:1:39131
      at async /var/task/.next/server/chunks/99.js:1:36639
      at async /var/task/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:36258
      at async eR.execute (/var/task/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:26874)
      at async eR.handle (/var/task/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:37512)
      at async es (/var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js:16:25465)
      at async en.responseCache.get.routeKind (/var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js:17:1026) {
    error: 'access_denied',
    errorDescription: 'Unauthorized',
    status: 400,
    statusCode: 400,
    openIdState: { returnTo: 'https://aa-next.vercel.app/' }
  },
  status: 400
}

```

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [August 12, 2024, 7:22pm UTC](https://community.auth0.com/t/next-app-deployed-on-vercel-callbackhandlererror-callback-handler-failed-cause-access-denied-unauthorized/140847/2 "2024-08-12T19:22:23Z")

</div>

Hi @bryso

Welcome to the Auth0 Community!

Thank you for posting your question. As your application is working properly locally, the issue may be connected to the Vercel caching mechanism.

We have an excellent Knowledge Solution regarding this issue, which you can find [here](https://community.auth0.com/t/callback-handler-fail-400-bad-request-with-nextjs/106174)  
[https://community.auth0.com/t/callback-handler-fail-400-bad-request-with-nextjs/106174](https://community.auth0.com/t/callback-handler-fail-400-bad-request-with-nextjs/106174)

Thanks  
Dawid

---

<div class="post-metadata">

**Author:** ![bryso](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bryso/32/59788_2.png) [@bryso](https://community.auth0.com/u/bryso)\
**Post date:** [August 13, 2024, 1:34pm UTC](https://community.auth0.com/t/next-app-deployed-on-vercel-callbackhandlererror-callback-handler-failed-cause-access-denied-unauthorized/140847/3 "2024-08-13T13:34:54Z")

</div>

Thanks, I tried the suggestions for disabling cache in the [Next docs](https://vercel.com/docs/infrastructure/data-cache/manage-data-cache), but it didn’t work for me 😕

I also was able to log in fine when I was originally deployed to a shared-hosting provider, which leads me to believe this wasn’t a caching issue.

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [August 13, 2024, 1:55pm UTC](https://community.auth0.com/t/next-app-deployed-on-vercel-callbackhandlererror-callback-handler-failed-cause-access-denied-unauthorized/140847/4 "2024-08-13T13:55:48Z")

</div>

Hi @bryso

Ok, so we’ll dig deeper. Can you check if your clientSecret is correct for the clientId?

You can also try the latest integration between Auth0 and Vercel → [https://vercel.com/integrations/auth0](https://vercel.com/integrations/auth0)

Thanks  
Dawid

---

<div class="post-metadata">

**Author:** ![bryso](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bryso/32/59788_2.png) [@bryso](https://community.auth0.com/u/bryso)\
**Post date:** [August 20, 2024, 4:04pm UTC](https://community.auth0.com/t/next-app-deployed-on-vercel-callbackhandlererror-callback-handler-failed-cause-access-denied-unauthorized/140847/5 "2024-08-20T16:04:23Z")

</div>

Ok I had some time to circle back to this. Apparently I was using the wrong clientId / secret combination somehow. It now seems to be working. Thanks!

---

<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:** [September 3, 2024, 4:05pm UTC](https://community.auth0.com/t/next-app-deployed-on-vercel-callbackhandlererror-callback-handler-failed-cause-access-denied-unauthorized/140847/6 "2024-09-03T16:05:18Z")

</div>

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