# Unauthorized client error using /token and grant\_type of client\_credentials

**URL:** <https://devforum.okta.com/t/unauthorized-client-error-using-token-and-grant-type-of-client-credentials/22613>\
**Category:** OAuth/OIDC\
**Created:** [November 29, 2022, 9:08pm UTC](https://devforum.okta.com/t/unauthorized-client-error-using-token-and-grant-type-of-client-credentials/22613 "2022-11-29T21:08:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnb](https://avatars.discourse-cdn.com/v4/letter/j/4491bb/32.png) [@johnb](https://devforum.okta.com/u/johnb)\
**Post date:** [November 29, 2022, 9:08pm UTC](https://devforum.okta.com/t/unauthorized-client-error-using-token-and-grant-type-of-client-credentials/22613/1 "2022-11-29T21:08:01Z")

</div>

I’m using Postman to test an Okta API call before I translate it to code.

I’m calling [https://XXX.okta.com/oauth2/v1/token](https://XXX.okta.com/oauth2/v1/token) and using a valid client\_id and client\_secret. I’m using a grant\_type of client\_credentials. (See Screen Shot)

I’m expecting to get back an access\_token per the docs, but instead I get the following error:  
{  
“error”: “unauthorized\_client”,  
“error\_description”: “The client is not authorized to use the provided grant type. Configured grant types: [refresh\_token, implicit, interaction\_code, authorization\_code].”  
}

My Okta Administrator tells me that he has turned on all grant types but the call still fails.

My best guess is that something needs to be done on the admin side to enable “client\_credentials” to work as a grant type for the /token API call. Can anyone provide specifics about where/how to do that? Thanks.

 ![Screen Shot 2022-11-29 at 2.01.51 PM](https://global.discourse-cdn.com/oktadev/original/2X/9/966a36ad52e6b9bc48a1219f322ff04705280e9b.png)

---

<div class="post-metadata">

**Author:** ![warren](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@warren](https://devforum.okta.com/u/warren)\
**Post date:** [November 29, 2022, 9:46pm UTC](https://devforum.okta.com/t/unauthorized-client-error-using-token-and-grant-type-of-client-credentials/22613/2 "2022-11-29T21:46:45Z")

</div>

Just to clarify, are you trying to use the client credentials flow to get an access token to be used with the Okta API (OAuth for Okta) or are you trying to use it with your custom API endpoints (API Access Management)?

---

<div class="post-metadata">

**Author:** ![johnb](https://avatars.discourse-cdn.com/v4/letter/j/4491bb/32.png) [@johnb](https://devforum.okta.com/u/johnb)\
**Post date:** [November 29, 2022, 9:54pm UTC](https://devforum.okta.com/t/unauthorized-client-error-using-token-and-grant-type-of-client-credentials/22613/3 "2022-11-29T21:54:10Z")

</div>

I want to call [https://xxx.okta.com/api/v1/users/{user\_name}](https://xxx.okta.com/api/v1/users/%7Buser_name%7D) in order to get back an Okta ID in my application.

That call requires an access token and I’m thinking this is the way to get that access token.

 ![Screen Shot 2022-11-29 at 2.53.28 PM](https://global.discourse-cdn.com/oktadev/original/2X/c/ca4111be4710e546d4bf34e98df96da822cfcd79.png)

---

<div class="post-metadata">

**Author:** ![warren](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@warren](https://devforum.okta.com/u/warren)\
**Post date:** [November 30, 2022, 12:25am UTC](https://devforum.okta.com/t/unauthorized-client-error-using-token-and-grant-type-of-client-credentials/22613/4 "2022-11-30T00:25:45Z")

</div>

Ok, looks like you want to use OAuth tokens for Okta API endpoint.

> **[Implement OAuth for Okta with a service app | Okta Developer](https://developer.okta.com/docs/guides/implement-oauth-for-okta-serviceapp/main/)**
>
> Secure, scalable, and highly available authentication and user management for any app.

You probably want to ask your Okta admin to create an API Services app for you. It’s possible they created a SPA or Native type app in Okta that don’t have the client credentials option.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [February 12, 2024, 10:26pm UTC](https://devforum.okta.com/t/unauthorized-client-error-using-token-and-grant-type-of-client-credentials/22613/5 "2024-02-12T22:26:11Z")

</div>

Closed on February 12, 2024, 10:26pm UTC

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