# Client Secret Invalid

**URL:** <https://devforum.okta.com/t/client-secret-invalid/10719>\
**Category:** Questions\
**Created:** [August 28, 2020, 4:14pm UTC](https://devforum.okta.com/t/client-secret-invalid/10719 "2020-08-28T16:14:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![faryenwede](https://avatars.discourse-cdn.com/v4/letter/f/4491bb/32.png) [@faryenwede](https://devforum.okta.com/u/faryenwede)\
**Post date:** [August 28, 2020, 4:14pm UTC](https://devforum.okta.com/t/client-secret-invalid/10719/1 "2020-08-28T16:14:34Z")

</div>

I’m trying to set up a new OAuth application and API in my Okta account. Following the guides posted here ([Implement authorization by grant type | Okta Developer](https://developer.okta.com/docs/guides/implement-client-creds/setup-app/)) and here ([Create an authorization server | Okta Developer](https://developer.okta.com/docs/guides/customize-authz-server/create-scopes/)), I was able to create an application and authorization server.

Unfortunately, when testing, I’m receiving the following error:

> . {“error”:“invalid\_client”,“error\_description”:“The client secret supplied for a confidential client is invalid.”}

The error would imply that my client\_secret is incorrect. However, I copied the client id and secret from the application. In addition, I encoded the client ID and client secret appropriately ( echo client\_id:client\_secret | base64 ). Here’s the curl statement that I’m using for testing:

> curl --request POST   
> –url {AUTH\_SERVER}/v1/token   
> –header ‘accept: application/json’   
> –header ‘Authorization: Basic $AUTH’   
> –header ‘cache-control: no-cache’   
> –header ‘content-type: application/x-www-form-urlencoded’   
> –data ‘grant\_type=client\_credentials&scope=custom\_scope+offline\_access’

Any thoughts on what might be up?

---

<div class="post-metadata">

**Author:** ![vijet](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/vijet/32/245_2.png) [@vijet](https://devforum.okta.com/u/vijet)\
**Post date:** [August 28, 2020, 10:25pm UTC](https://devforum.okta.com/t/client-secret-invalid/10719/2 "2020-08-28T22:25:40Z")

</div>

Hi @faryenwede,

I was able to get this working by doing the following -

1. Create a service application and note client\_id and client\_secret.
2. Generate the base64 encoded auth header using [https://simplycalc.com/base64url-encode.php](https://simplycalc.com/base64url-encode.php) (client\_id:client\_secret)
3. Create a custom scope on your custom authorization server (I used the `default` authorization server)
4. Make the following curl request -

```auto
curl --request POST \
  --url https://my-okta-org.com/oauth2/default/v1/token \
  --header 'accept: application/json' \
  --header 'authorization: Basic MG9h....' \
  --header 'cache-control: no-cache' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data 'grant_type=client_credentials&scope=custom'

```

Make sure you’re using the right `/token` endpoint, the right encoding, and also try with only `custom_scope` first.  
If you can post screenshots of your application and auth server, that might give some clues.

---

<div class="post-metadata">

**Author:** ![faryenwede](https://avatars.discourse-cdn.com/v4/letter/f/4491bb/32.png) [@faryenwede](https://devforum.okta.com/u/faryenwede)\
**Post date:** [September 8, 2020, 10:27pm UTC](https://devforum.okta.com/t/client-secret-invalid/10719/3 "2020-09-08T22:27:58Z")

</div>

Thank you. That was the solution.

---

<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:** [January 25, 2024, 6:36pm UTC](https://devforum.okta.com/t/client-secret-invalid/10719/4 "2024-01-25T18:36:31Z")

</div>

Closed on January 25, 2024, 6:36pm UTC

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