# /oauth/device/code endpoint error unauthorized\_client

**URL:** <https://community.auth0.com/t/oauth-device-code-endpoint-error-unauthorized-client/116799>\
**Category:** Get Help\
**Tags:** device-credentials, management-api\
**Created:** [September 21, 2023, 9:48am UTC](https://community.auth0.com/t/oauth-device-code-endpoint-error-unauthorized-client/116799 "2023-09-21T09:48:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![erik1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/erik1/32/51091_2.png) [@erik1](https://community.auth0.com/u/erik1)\
**Post date:** [September 21, 2023, 9:48am UTC](https://community.auth0.com/t/oauth-device-code-endpoint-error-unauthorized-client/116799/1 "2023-09-21T09:48:03Z")

</div>

Hello,

I’m trying out some POST calls in Postman. I can get it to work with in my terminal with curl but not Postman (or Axios request in an app).

What works with curl:

```auto
  curl --request POST \
  --url 'https://{DEVICE_AUTH_URL_123}/oauth/device/code' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data 'client_id={CLIENT_ID_123}&scope=openid&audience=AUDIENCE_URL_123'

```

What doesn’t work in Postman:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/8/3/837165f30886d2ab1c382cade5d3f2518f604b92.png)

Error I get in Auth0 logs:

```auto
{
  "body": {},
  "qs": {
    "client_id": "CLIENT_ID_123",
    "scope": "openid",
    "audience": "AUDIENCE_URL_123"
  },
  "error": {
    "message": "Unauthorized or unknown client",
    "oauthError": "unauthorized_client",
    "type": "oauth-authorization"
  }
}

```

Appreciate any help I can get!

---

<div class="post-metadata">

**Author:** ![julien.nanquette](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/julien.nanquette/32/51041_2.png) [@julien.nanquette](https://community.auth0.com/u/julien.nanquette)\
**Post date:** [September 21, 2023, 3:03pm UTC](https://community.auth0.com/t/oauth-device-code-endpoint-error-unauthorized-client/116799/2 "2023-09-21T15:03:09Z")

</div>

Hi,

Did you put “DEVICE\_AUTH\_URL\_123”, “CLIENT\_ID\_123” and “AUDIENCE\_URL\_123” in your Postman request like that just for the example ? Because device auth url and client id you put in your Curl are variables, but don’t seem to be such in Postman.  
Also, have you ensured your application in Auth0 has device code grant type enabled ?

Edit : I just noticed something : you put client id, scope and audience as parameters, but you have to add these in the body, in “x-www-form-urlencoded” !

---

<div class="post-metadata">

**Author:** ![erik1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/erik1/32/51091_2.png) [@erik1](https://community.auth0.com/u/erik1)\
**Post date:** [September 22, 2023, 5:59am UTC](https://community.auth0.com/t/oauth-device-code-endpoint-error-unauthorized-client/116799/3 "2023-09-22T05:59:51Z")

</div>

Thanks for your reply!

I did not put “DEVICE\_AUTH\_URL\_123”, “CLIENT\_ID\_123” and “AUDIENCE\_URL\_123” in Postman, I put actual values.

As for headers, `Content-Type: application/x-www-form-urlencoded` is set in Postman as well.

---

<div class="post-metadata">

**Author:** ![julien.nanquette](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/julien.nanquette/32/51041_2.png) [@julien.nanquette](https://community.auth0.com/u/julien.nanquette)\
**Post date:** [September 22, 2023, 7:25am UTC](https://community.auth0.com/t/oauth-device-code-endpoint-error-unauthorized-client/116799/4 "2023-09-22T07:25:44Z")

</div>

Have you tried putting client\_id, scope and audience in the request body like I asked in my post edit ? I noticed you had put these as parameters before, but I think the API is waiting for a body.

---

<div class="post-metadata">

**Author:** ![erik1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/erik1/32/51091_2.png) [@erik1](https://community.auth0.com/u/erik1)\
**Post date:** [September 22, 2023, 10:57am UTC](https://community.auth0.com/t/oauth-device-code-endpoint-error-unauthorized-client/116799/5 "2023-09-22T10:57:07Z")

</div>

That was it, thank you! 🙂

It appears to have been a change in behaviour. Not sure if it’s on Auth0 or Axios.

I have an app running in prod for two years which added the client id etc as url params and not body.

Used `axios 0.2.4`. But when I did a minor bump of Axios, I got this error but still had the same code.

So for reference, if somebody encouter this problems, move the variables from params to body!

---

<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:** [October 6, 2023, 10:57am UTC](https://community.auth0.com/t/oauth-device-code-endpoint-error-unauthorized-client/116799/6 "2023-10-06T10:57:41Z")

</div>

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