# /oath/token end-point stopped returning valid response

**URL:** <https://community.auth0.com/t/oath-token-end-point-stopped-returning-valid-response/95255>\
**Category:** Get Help\
**Tags:** anomaly, management-api\
**Created:** [November 28, 2022, 10:18pm UTC](https://community.auth0.com/t/oath-token-end-point-stopped-returning-valid-response/95255 "2022-11-28T22:18:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![iphonelynden](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/iphonelynden/32/35380_2.png) [@iphonelynden](https://community.auth0.com/u/iphonelynden)\
**Post date:** [November 28, 2022, 10:18pm UTC](https://community.auth0.com/t/oath-token-end-point-stopped-returning-valid-response/95255/1 "2022-11-28T22:18:47Z")

</div>

Hi, after some time coding on my express back-end, the /oath/token end-point suddenly stopped returning a valid response.

Expected behaviour is to receive a “data: { access\_token, …}” property.

What I receive is “nonsense” characters: “data: c�@�lf��\>��a���9!и鱺���’c��…”

This is the code for getting the token:

```auto
const getAuthToken = async (): Promise<string | null> => {
  const options: AxiosRequestConfig = {
    baseURL: DOMAIN,
    url: '/oauth/token',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: {
      client_id: CLIENT_ID,
      client_secret: CLIENT_SECRET,
      audience: AUDIENCE,
      grant_type: 'client_credentials',
    },
  };

  try {
    const response = await axios(options);

    console.log(response.data);

    if (response.status === 200) return response.data.access_token;
    return null;
  } catch (err) {
    console.log(err);
    return null;
  }
};

```

This worked beautifully until an hour ago, when it just stopped providing the expected response.

Thank you,  
Martin

---

<div class="post-metadata">

**Author:** ![iphonelynden](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/iphonelynden/32/35380_2.png) [@iphonelynden](https://community.auth0.com/u/iphonelynden)\
**Post date:** [November 29, 2022, 8:21pm UTC](https://community.auth0.com/t/oath-token-end-point-stopped-returning-valid-response/95255/2 "2022-11-29T20:21:00Z")

</div>

Problem solved.

I had to add ‘accept-encoding: application/json’ to my Axios ‘headers’ to be rid of the problem. I still have no clue why this worked before, nor why it suddenly stopped working. But this fixed the issue.

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [November 29, 2022, 10:14pm UTC](https://community.auth0.com/t/oath-token-end-point-stopped-returning-valid-response/95255/3 "2022-11-29T22:14:32Z")

</div>

Hey there @iphonelynden welcome to the community and thanks for following up on this!

I know `'content-type': 'application/json'` is typically included like you have it, but I haven’t seen where `accept-encoding: application/json` is required so thanks for the heads up, hopefully this helps someone else in the future!

---

<div class="post-metadata">

**Author:** ![iphonelynden](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/iphonelynden/32/35380_2.png) [@iphonelynden](https://community.auth0.com/u/iphonelynden)\
**Post date:** [November 30, 2022, 11:45am UTC](https://community.auth0.com/t/oath-token-end-point-stopped-returning-valid-response/95255/4 "2022-11-30T11:45:57Z")

</div>

Thanks @ty.frith , I have a sneaking suspicion that it is related to Axios release 1.2.0 a few days ago, but haven’t been able to confirm. They did do something to their AxiosHeaders class at least.

---

<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 14, 2022, 11:46am UTC](https://community.auth0.com/t/oath-token-end-point-stopped-returning-valid-response/95255/5 "2022-12-14T11:46:29Z")

</div>

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