# Getting "confidential client" error

**URL:** <https://devforum.okta.com/t/getting-confidential-client-error/5474>\
**Category:** Questions\
**Created:** [June 24, 2019, 4:58pm UTC](https://devforum.okta.com/t/getting-confidential-client-error/5474 "2019-06-24T16:58:21Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe.mcmahon](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@joe.mcmahon](https://devforum.okta.com/u/joe.mcmahon)\
**Post date:** [June 24, 2019, 4:58pm UTC](https://devforum.okta.com/t/getting-confidential-client-error/5474/1 "2019-06-24T16:58:21Z")

</div>

I followed the steps here:

> **[Serverless Okta JWT as AWS API Gateway Authorizer](http://rafpe.ninja/2018/12/17/serverless-okta-jwt-as-aws-api-gateway-authorizer/)**
>
> About this solution In todays technological world it has become very popular ( and quite easy )  to create serverless architectures with Lambdas and expose them via API gateway. The expose part is …

and then ran this:

curl -X POST   
[https://dev-XXXXXX.oktapreview.com/oauth2/ausl2ncr0ftfu3Kmn0h7/v1/token](https://dev-XXXXXX.oktapreview.com/oauth2/ausl2ncr0ftfu3Kmn0h7/v1/token)   
-H ‘Cache-Control: no-cache’   
-H ‘Content-Type: application/x-www-form-urlencoded’   
-d ‘username=xxx@yyy.com&password=#######&grant\_type=password&scope=openid’

and ended up with this error:

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

Any ideas?

---

<div class="post-metadata">

**Author:** ![dragos](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/dragos/32/1313_2.png) [@dragos](https://devforum.okta.com/u/dragos)\
**Post date:** [June 25, 2019, 10:08am UTC](https://devforum.okta.com/t/getting-confidential-client-error/5474/2 "2019-06-25T10:08:57Z")

</div>

Hi @joe.mcmahon

Can you please check if the Authorization header contains the correct credentials? The algorithm for the header should look something like

```auto
"Authorization: Basic " + base64_encode(client_id + ":" + client_secret)

```

---

<div class="post-metadata">

**Author:** ![joe.mcmahon](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@joe.mcmahon](https://devforum.okta.com/u/joe.mcmahon)\
**Post date:** [June 25, 2019, 11:15am UTC](https://devforum.okta.com/t/getting-confidential-client-error/5474/3 "2019-06-25T11:15:28Z")

</div>

Yes, sorry, I didn’t cut & paste the whole thing. I have the following (abbreviated here) as the 2nd line before the Cache Control one:

-H ‘Authorization: Basic MG9hbH…VdAo=’

---

<div class="post-metadata">

**Author:** ![dragos](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/dragos/32/1313_2.png) [@dragos](https://devforum.okta.com/u/dragos)\
**Post date:** [June 25, 2019, 11:45am UTC](https://devforum.okta.com/t/getting-confidential-client-error/5474/4 "2019-06-25T11:45:24Z")

</div>

Hi @joe.mcmahon

Would it be possible to send us an email to [developers@okta.com](mailto:developers@okta.com) in order to have this further investigated internally?

---

<div class="post-metadata">

**Author:** ![micah.silverman](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/micah.silverman/32/1239_2.png) [@micah.silverman](https://devforum.okta.com/u/micah.silverman)\
**Post date:** [June 25, 2019, 12:44pm UTC](https://devforum.okta.com/t/getting-confidential-client-error/5474/5 "2019-06-25T12:44:22Z")

</div>

You’ll also need to add offline\_access scope in addition to openid for the password flow

---

<div class="post-metadata">

**Author:** ![daveh](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/daveh/32/1300_2.png) [@daveh](https://devforum.okta.com/u/daveh)\
**Post date:** [January 22, 2020, 6:01am UTC](https://devforum.okta.com/t/getting-confidential-client-error/5474/6 "2020-01-22T06:01:26Z")

</div>

Hi, I am having the same issue. Was this resolved ?  
@micah.silverman, how do you “add offline\_access scope” ? is scope comma separated ? I tried that and it did not solve the issue.

Thanks

---

<div class="post-metadata">

**Author:** ![dragos](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/dragos/32/1313_2.png) [@dragos](https://devforum.okta.com/u/dragos)\
**Post date:** [January 22, 2020, 7:27am UTC](https://devforum.okta.com/t/getting-confidential-client-error/5474/7 "2020-01-22T07:27:10Z")

</div>

Hi @daveh

Can you please use a different base64 encoder in order to encode the client id and client secret in the authorization header?

---

<div class="post-metadata">

**Author:** ![micah.silverman](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/micah.silverman/32/1239_2.png) [@micah.silverman](https://devforum.okta.com/u/micah.silverman)\
**Post date:** [January 22, 2020, 2:33pm UTC](https://devforum.okta.com/t/getting-confidential-client-error/5474/8 "2020-01-22T14:33:06Z")

</div>

scopes are space separated and url encoded. So, you’d use a plus sign (+):

scope=openid+offline\_access

Also, you need to use a custom authorization server, as opposed to the org level authorization server.

So, the token endpoint would be something like:

[https://micah.okta.com/oauth2/aus2yrcz7aMrmDAKZ1t7/v1/token](https://micah.okta.com/oauth2/aus2yrcz7aMrmDAKZ1t7/v1/token)

not

[https://micah.okta.com/oauth2/v1/token](https://micah.okta.com/oauth2/v1/token)

---

<div class="post-metadata">

**Author:** ![daveh](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/daveh/32/1300_2.png) [@daveh](https://devforum.okta.com/u/daveh)\
**Post date:** [January 22, 2020, 11:44pm UTC](https://devforum.okta.com/t/getting-confidential-client-error/5474/9 "2020-01-22T23:44:01Z")

</div>

Hi @dragos, When I switched to python rather than linux command line, it worked. There was 1 character different in the encoded string. No idea why…  
Thanks !

---

<div class="post-metadata">

**Author:** ![daveh](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/daveh/32/1300_2.png) [@daveh](https://devforum.okta.com/u/daveh)\
**Post date:** [January 23, 2020, 12:01am UTC](https://devforum.okta.com/t/getting-confidential-client-error/5474/10 "2020-01-23T00:01:32Z")

</div>

Awesome, Thanks for your help.

---

<div class="post-metadata">

**Author:** ![janusz](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/janusz/32/4592_2.png) [@janusz](https://devforum.okta.com/u/janusz)\
**Post date:** [March 8, 2023, 5:29pm UTC](https://devforum.okta.com/t/getting-confidential-client-error/5474/11 "2023-03-08T17:29:37Z")

</div>

I’ll just leave a note here, this happened to me but only when using Docker and the okta secret was wrapped with single quotes. While this worked just fine on bare metal server, somehow the value passed to Docker (also running on the railway.app platform) contained invalid characters ’

---

<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 13, 2024, 12:38am UTC](https://devforum.okta.com/t/getting-confidential-client-error/5474/12 "2024-02-13T00:38:28Z")

</div>

Closed on February 13, 2024, 12:38am UTC

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