# Callback url not working in Next js SDK

**URL:** <https://community.auth0.com/t/callback-url-not-working-in-next-js-sdk/80800>\
**Category:** Get Help\
**Tags:** auth0\
**Created:** [March 30, 2022, 11:23am UTC](https://community.auth0.com/t/callback-url-not-working-in-next-js-sdk/80800 "2022-03-30T11:23:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chintanjoyn](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/chintanjoyn/32/35615_2.png) [@chintanjoyn](https://community.auth0.com/u/chintanjoyn)\
**Post date:** [March 30, 2022, 11:23am UTC](https://community.auth0.com/t/callback-url-not-working-in-next-js-sdk/80800/1 "2022-03-30T11:23:05Z")

</div>

Below screen show after successfully login.

 ![Screenshot 2022-03-30 at 4.49.40 PM](https://global.discourse-cdn.com/auth0/original/3X/6/e/6e3468578d71fde344f12469a24430c5ba4f7086.jpeg)  
Auth0 Configuration of callbackurl.  
 ![Screenshot 2022-03-30 at 4.50.03 PM](https://global.discourse-cdn.com/auth0/original/3X/4/b/4b7d3d46ed64430643cff0dd8cabbffe4bf49c8a.jpeg)

Auth0 LOG:

{  
“date”: “2022-03-30T11:19:28.134Z”,  
“type”: “feacft”,  
“description”: “Unauthorized”,  
“connection\_id”: “”,  
“client\_id”: null,  
“client\_name”: null,  
“ip”: “49.36.89.123”,  
“user\_agent”: “Other 0.0.0 / Other 0.0.0”,  
“details”: {  
“code”: “\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*o2E”  
},  
“hostname”: “[dev-6p3m670a.us.auth0.com](http://dev-6p3m670a.us.auth0.com)”,  
“user\_id”: “”,  
“user\_name”: “”,  
“auth0\_client”: {  
“name”: “nextjs-auth0”,  
“version”: “1.7.0”,  
“env”: {  
“node”: “v14.18.2”  
}  
},  
“log\_id”: “90020220330111933198262481456900431017025113646841200658”,  
“\_id”: “90020220330111933198262481456900431017025113646841200658”,  
“isMobile”: false  
}

---

<div class="post-metadata">

**Author:** ![lihua.zhang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lihua.zhang/32/39683_2.png) [@lihua.zhang](https://community.auth0.com/u/lihua.zhang)\
**Post date:** [March 30, 2022, 5:27pm UTC](https://community.auth0.com/t/callback-url-not-working-in-next-js-sdk/80800/3 "2022-03-30T17:27:28Z")

</div>

Hi @chintanjoyn ,

Welcome to the Auth0 Community!

I noticed that your callback URL includes /api/auth/. Do you mind updating it to [http://localhost:3000/callback](http://localhost:3000/callback) and giving it a try? Please keep us updated on how it goes. Thanks!

---

<div class="post-metadata">

**Author:** ![chintanjoyn](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/chintanjoyn/32/35615_2.png) [@chintanjoyn](https://community.auth0.com/u/chintanjoyn)\
**Post date:** [March 31, 2022, 4:08am UTC](https://community.auth0.com/t/callback-url-not-working-in-next-js-sdk/80800/4 "2022-03-31T04:08:21Z")

</div>

@lihua.zhang Thank You! for your replay, steel it not working give below error in LOG.

{  
“date”: “2022-03-31T04:06:24.602Z”,  
“type”: “f”,  
“description”: “Callback URL mismatch. [http://localhost:3000/api/auth/callback](http://localhost:3000/api/auth/callback) is not in the list of allowed callback URLs”,  
“connection\_id”: “”,  
“ip”: “180.211.109.242”,  
“user\_agent”: “Chrome 99.0.4844 / Mac OS X 10.15.7”,  
“details”: {  
“body”: {},  
“qs”: {  
“client\_id”: “oVVP98b79AWMbKEMWg56JZOVtw8rDdx9”,  
“scope”: “openid profile email”,  
“response\_type”: “code”,  
“redirect\_uri”: “[http://localhost:3000/api/auth/callback](http://localhost:3000/api/auth/callback)”,  
“nonce”: “WXmokKsilB2tiJ7Rdxm0H7s32YN-5c5-A68V39H4TmE”,  
“state”: “eyJyZXR1cm5UbyI6Imh0dHA6Ly9sb2NhbGhvc3Q6MzAwMC8ifQ”,  
“code\_challenge”: “wTq2CLMWT2gvtOTLFMneGs0BLIYm6Nur8Jq0ElspEcg”,  
“code\_challenge\_method”: “S256”  
},  
“error”: {  
“message”: “Callback URL mismatch. [http://localhost:3000/api/auth/callback](http://localhost:3000/api/auth/callback) is not in the list of allowed callback URLs”,  
“oauthError”: “Callback URL mismatch. [http://localhost:3000/api/auth/callback](http://localhost:3000/api/auth/callback) is not in the list of allowed callback URLs. Please go to ‘[https://manage.auth0.com/#/applications/oVVP98b79AWMbKEMWg56JZOVtw8rDdx9/settings](https://manage.auth0.com/#/applications/oVVP98b79AWMbKEMWg56JZOVtw8rDdx9/settings)’ and make sure you are sending the same callback url from your application.”,  
“payload”: {  
“message”: “Callback URL mismatch. [http://localhost:3000/api/auth/callback](http://localhost:3000/api/auth/callback) is not in the list of allowed callback URLs”,  
“code”: “unauthorized\_client”,  
“status”: 403,  
“name”: “CallbackMismatchError”,  
“authorized”: [  
“[http://localhost:3000/callback](http://localhost:3000/callback)”  
],  
“attempt”: “[http://localhost:3000/api/auth/callback](http://localhost:3000/api/auth/callback)”,  
“client”: {  
“clientID”: “oVVP98b79AWMbKEMWg56JZOVtw8rDdx9”  
},  
“log\_url”: “[https://manage.auth0.com/#/logs/](https://manage.auth0.com/#/logs/)”  
},  
“type”: “callback-url-mismatch”  
}  
},  
“hostname”: “[dev-6p3m670a.us.auth0.com](http://dev-6p3m670a.us.auth0.com)”,  
“log\_id”: “90020220331040627526920649201086898600243609953437220866”,  
“\_id”: “90020220331040627526920649201086898600243609953437220866”,  
“isMobile”: false  
}

 ![Screenshot 2022-03-31 at 9.38.52 AM](https://global.discourse-cdn.com/auth0/original/3X/a/f/af15f736a0f05a2dd83936d8faafdd88b4b2e3b9.png)

---

<div class="post-metadata">

**Author:** ![lihua.zhang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lihua.zhang/32/39683_2.png) [@lihua.zhang](https://community.auth0.com/u/lihua.zhang)\
**Post date:** [March 31, 2022, 6:05pm UTC](https://community.auth0.com/t/callback-url-not-working-in-next-js-sdk/80800/6 "2022-03-31T18:05:01Z")

</div>

Thank you for the updates.

I tested this issue with the Auth0 sample Next.js project and could not repeat this error.

Here are the steps of my testing:

1. create a new Regular Web Application
2. open the Application, under Quick Start tab, click on Next.js, and click on “Download Sample”.
3. under the Settings tab, enter [http://localhost:3000/api/auth/callback](http://localhost:3000/api/auth/callback) in the “Allowed Callback URLs” field and enter [http://localhost:3000](http://localhost:3000) in the “Allowed Logout URLs” field. The values you entered initially were correct, sorry about the misleading earlier.
4. open the downloaded project in VS Code. You may notice that the environment variables are pre-populated like this.  
 ![image](https://global.discourse-cdn.com/auth0/original/3X/5/5/550426f6dca536dae739bc21adbc326c9747f881.jpeg)
5. open terminal in VS code and run  
`npm install && npm run dev`
6. go to [http://localhost:3000](http://localhost:3000)

BTW, in your screenshot, I noticed the “Allowed Logout URLs” has a “/” at the end. Could you remove it, save the application and give it a try?

Hope it helps!

---

<div class="post-metadata">

**Author:** ![chintanjoyn](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/chintanjoyn/32/35615_2.png) [@chintanjoyn](https://community.auth0.com/u/chintanjoyn)\
**Post date:** [April 1, 2022, 5:24am UTC](https://community.auth0.com/t/callback-url-not-working-in-next-js-sdk/80800/7 "2022-04-01T05:24:27Z")

</div>

Hi @lihua.zhang Thank You! for your replay.

There are issue in client secret key.So i replaced it in environment variable from application and it working fine!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 21, 2022, 5:11pm UTC](https://community.auth0.com/t/callback-url-not-working-in-next-js-sdk/80800/8 "2022-12-21T17:11:22Z")

</div>


