# Auth0 NextJS Toekn Exchange 400 unauthroized

**URL:** <https://community.auth0.com/t/auth0-nextjs-toekn-exchange-400-unauthroized/157686>\
**Category:** Get Help\
**Tags:** classic-universal-login-experience, login-experience\
**Created:** [December 5, 2024, 5:15pm UTC](https://community.auth0.com/t/auth0-nextjs-toekn-exchange-400-unauthroized/157686 "2024-12-05T17:15:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![techadmin2](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/techadmin2/32/50714_2.png) [@techadmin2](https://community.auth0.com/u/techadmin2)\
**Post date:** [December 5, 2024, 5:15pm UTC](https://community.auth0.com/t/auth0-nextjs-toekn-exchange-400-unauthroized/157686/1 "2024-12-05T17:15:19Z")

</div>

Ready to post? 🔍 First, try searching for your answer.  
I’m trying to set up my web application in a production environment.

This is working perfectly fine in development, and I’m unable to see any difference in settings between environments.

The inital login request contains the client id  
https://[DOMAIN]/authorize?client\_id=&scope=openid%2520profile%2520read%3Ashows%2520offline\_access&response\_type=code&redirect\_uri=https%3A%2F%2F{DOMAIN]%2Fapi%2Fauth%2Fcallback&audience=https%3A%2F%2Fapi.[DOMAIN]&prompt=login&nonce=…

Fails when it sucessfully logs in with 400 error

https://{DOMAIN}/api/auth/callback?code=…&state=…

{  
“date”: “2024-12-05T17:11:13.489Z”,  
“type”: “feacft”,  
“description”: “Unauthorized”,  
“connection\_id”: “”,  
“client\_id”: null,  
“client\_name”: null,  
“ip”: “34.34.248.84”,  
“user\_agent”: “Other 0.0.0 / Other 0.0.0”,  
“details”: {  
“code”: “\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*Lck”  
},  
“hostname”: “[TENNANT]”,  
“user\_id”: “”,  
“user\_name”: “”,  
“auth0\_client”: {  
“name”: “nextjs-auth0”,  
“version”: “3.5.0”,  
“env”: {  
“node”: “v20.17.0”  
}  
},  
“$event\_schema”: {  
“version”: “1.0.0”  
},  
“log\_id”: “…”,  
“tenant\_name”: “my-normative-production”,  
“\_id”: “…”,  
“isMobile”: false,  
“originalData”: {  
“date”: “2024-12-05T17:11:13.489Z”,  
“type”: “feacft”,  
“description”: “Unauthorized”,  
“connection\_id”: “”,  
“client\_id”: null,  
“client\_name”: null,  
“ip”: “34.34.248.84”,  
“user\_agent”: “Other 0.0.0 / Other 0.0.0”,  
“details”: {  
“code”: “\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*Lck”  
},  
“hostname”: “[TENNANT]”,  
“user\_id”: “”,  
“user\_name”: “”,  
“auth0\_client”: {  
“name”: “nextjs-auth0”,  
“version”: “3.5.0”,  
“env”: {  
“node”: “v20.17.0”  
}  
},  
“$event\_schema”: {  
“version”: “1.0.0”  
},  
“log\_id”: …",  
“tenant\_name”: “[TENANT]”,  
“\_id”: “…”,  
“isMobile”: false  
},  
“integrityRuleset”: {},  
“id”: “…”  
}

I’ve tried changing auth token endpoint bhaviour and that has no effect.

Any thoughts?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [December 5, 2024, 7:16pm UTC](https://community.auth0.com/t/auth0-nextjs-toekn-exchange-400-unauthroized/157686/3 "2024-12-05T19:16:03Z")

</div>

Hi @techadmin2,

Thanks for reaching out to the Auth0 Community!

After reviewing the error log you shared, the [`feacft`](https://auth0.com/docs/deploy-monitor/logs/log-event-type-codes#:~:text=Failed%20User%20Deletion-,feacft,-Failed%20Exchange) error code refers to failing to exchange the authorization code for an access token.

This means that the request to your `/oauth/token` endpoint was not successful because of some variety of reasons that caused it to fail. For example, the code might have been used, invalid, or expired. The other possibility is if any of the parameters in the request, like the `client_id` and `client_secret`, are using incorrect values.

Thanks,  
Rueben

---

<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:** [December 19, 2024, 7:16pm UTC](https://community.auth0.com/t/auth0-nextjs-toekn-exchange-400-unauthroized/157686/4 "2024-12-19T19:16:34Z")

</div>

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