# Failed Exchange : client\_id seems to be null

**URL:** <https://community.auth0.com/t/failed-exchange-client-id-seems-to-be-null/115922>\
**Category:** Get Help\
**Tags:** login-prompt-new-experience, login-experience\
**Created:** [September 11, 2023, 3:10pm UTC](https://community.auth0.com/t/failed-exchange-client-id-seems-to-be-null/115922 "2023-09-11T15:10:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![pon9q9](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pon9q9/32/48955_2.png) [@pon9q9](https://community.auth0.com/u/pon9q9)\
**Post date:** [September 11, 2023, 3:10pm UTC](https://community.auth0.com/t/failed-exchange-client-id-seems-to-be-null/115922/1 "2023-09-11T15:10:59Z")

</div>

I tried to login from next.js (using docker image), and I followed this instruction([Auth0 Next.js SDK Quickstarts: Login](https://auth0.com/docs/quickstart/webapp/nextjs/01-login)).  
However, the login operation doesn’t work. Log seems to say that Failed Exchange Error occured, and the request doesn’t contain client\_id. When I send a request to login([http://localhost:3000/api/auth/login](http://localhost:3000/api/auth/login)), login page appeared correctly, but after submitting the form

 ![スクリーンショット 2023-09-12 0.00.32](https://global.discourse-cdn.com/auth0/original/3X/9/0/907a5374ca1c90844b6550df5cebd3b9c8784245.png)  
 ![スクリーンショット 2023-09-12 0.01.33](https://global.discourse-cdn.com/auth0/original/3X/3/5/35bc030f32efa1fe6e501179426abb3330223e24.png)  
Error 400 appeared with the callback address ([http://localhost:3000/api/auth/callback/?code=52AzR\_5POGs-gBRZx6GTdEbRu2tQ4LlvOc8E2V11V-U6s&state=eyJyZXR1cm5UbyI6Imh0dHA6Ly9sb2NhbGhvc3Q6MzAwMCJ9](http://localhost:3000/api/auth/callback/?code=52AzR_5POGs-gBRZx6GTdEbRu2tQ4LlvOc8E2V11V-U6s&state=eyJyZXR1cm5UbyI6Imh0dHA6Ly9sb2NhbGhvc3Q6MzAwMCJ9)).  
How can I fix this?

---

<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:** [September 11, 2023, 7:44pm UTC](https://community.auth0.com/t/failed-exchange-client-id-seems-to-be-null/115922/3 "2023-09-11T19:44:14Z")

</div>

Hi @pon9q9,

Welcome to the Auth0 Community!

It looks like this was answered in a similar Community Post:

> [@Failed Exchange: Unauthorized (feacft)](https://community.auth0.com/t/failed-exchange-unauthorized-feacft/44537/2):
>
> The solution is to enable OIDC Conformant and set the refresh token behavior to Rotating.

If you found this post helpful or interesting, please give it a like 👍 . Your interaction makes a difference. **Have a wonderful day!** 🌞

Thanks,  
Rueben

* * *

[Want to join our next Community Interactive Q&A with our experts? This time we’re gonna talk about Auth0 Terraform Provider](https://community.auth0.com/t/ask-me-anything-with-auth0-terraform-provider/115670)

---

<div class="post-metadata">

**Author:** ![pon9q9](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pon9q9/32/48955_2.png) [@pon9q9](https://community.auth0.com/u/pon9q9)\
**Post date:** [September 11, 2023, 11:25pm UTC](https://community.auth0.com/t/failed-exchange-client-id-seems-to-be-null/115922/4 "2023-09-11T23:25:36Z")

</div>

Rueben, thank you for your advice. I’ve already tried that way but it didn’t work. I also tried to change “Grant\_types” to exclude “Client Credentials” ([Success Login and a Failed Exchange - #9 by sagun786](https://community.auth0.com/t/success-login-and-a-failed-exchange/41513/9)) but nothing happene

 ![スクリーンショット 2023-09-12 8.18.53](https://global.discourse-cdn.com/auth0/original/3X/7/2/725372490435e81cf0735d8c34d8e776b5e4bdf2.jpeg)  
 ![スクリーンショット 2023-09-12 8.19.01](https://global.discourse-cdn.com/auth0/original/3X/2/b/2b051da373fdeabb157d89b0808906420f6b5226.png)  
 ![スクリーンショット 2023-09-12 8.19.15](https://global.discourse-cdn.com/auth0/original/3X/7/a/7acfd358b9b3eab0d8d18703f8fd89c22b00012c.png)  
d.

---

<div class="post-metadata">

**Author:** ![pon9q9](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pon9q9/32/48955_2.png) [@pon9q9](https://community.auth0.com/u/pon9q9)\
**Post date:** [September 11, 2023, 11:34pm UTC](https://community.auth0.com/t/failed-exchange-client-id-seems-to-be-null/115922/5 "2023-09-11T23:34:57Z")

</div>

It is strange that this “Failed Exchange” always follows a “Success Login” log, and when I have “Success Login”, client\_id works. It suggest that login part succeed but exchange part failed. The error on Google Chrome is this, and the code on […auth0].js is this. Please tell me if I can show any other information.

 ![スクリーンショット 2023-09-12 8.29.17](https://global.discourse-cdn.com/auth0/original/3X/2/e/2e2a3a110ce9fa8a3c8068cb571642cda7507875.jpeg)  
 ![スクリーンショット 2023-09-12 8.37.36](https://global.discourse-cdn.com/auth0/original/3X/b/1/b1b83b2b525df8f018396bc23719854a6e841a22.png)  
 ![スクリーンショット 2023-09-12 8.38.03](https://global.discourse-cdn.com/auth0/original/3X/7/1/71d9270c5e27ff072c63f33abe5f2eaa998eb8f0.jpeg)

---

<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:** [September 13, 2023, 5:10pm UTC](https://community.auth0.com/t/failed-exchange-client-id-seems-to-be-null/115922/6 "2023-09-13T17:10:50Z")

</div>

Hi @pon9q9,

Thank you for your responses.

I have just looked carefully into the [`feacft` log event type](https://auth0.com/docs/deploy-monitor/logs/log-event-type-codes#:~:text=Failed%20User%20Deletion-,feacft,-Failed%20Exchange) and found that this error happens when it failed to exchange the authorization code for a token.

I was able to reproduce this error when I passed incorrect values for either the **client\_id** , **client\_secret** , or **domain** in the request.

In this case, could you please make sure that you are exchanging your authorization code for a token with something like the following and making sure all the values are correct:

```auto
curl --request POST \
  --url 'https://{yourDomain}/oauth/token' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data grant_type=authorization_code \
  --data 'client_id={yourClientId}' \
  --data 'client_secret={yourClientSecret}' \
  --data 'code=yourAuthorizationCode}' \
  --data 'redirect_uri={https://yourApp/callback}'

```

Please let me know how this goes for you.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![pon9q9](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pon9q9/32/48955_2.png) [@pon9q9](https://community.auth0.com/u/pon9q9)\
**Post date:** [September 14, 2023, 1:28am UTC](https://community.auth0.com/t/failed-exchange-client-id-seems-to-be-null/115922/7 "2023-09-14T01:28:07Z")

</div>

I really appreciate your great suppport, Rueben.  
Actually I found my mistake and the problem solved. My AUTH0\_SECRET is for another application and that cause this problem. Your generous support really helps me and makes me love auth0 more. Thanks a lot!

---

<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:** [September 14, 2023, 4:51pm UTC](https://community.auth0.com/t/failed-exchange-client-id-seems-to-be-null/115922/8 "2023-09-14T16:51:36Z")

</div>

Hi @pon9q9,

You’re most welcome!

I’m glad you were able to solve it by passing in the correct _client\_secret_ in the request!

Please let us know if you have any additional questions.

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:** [September 28, 2023, 4:51pm UTC](https://community.auth0.com/t/failed-exchange-client-id-seems-to-be-null/115922/9 "2023-09-28T16:51:55Z")

</div>

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