# Invalid\_client - Client authentication failed SPA

**URL:** <https://devforum.okta.com/t/invalid-client-client-authentication-failed-spa/8043>\
**Category:** Questions\
**Created:** [February 11, 2020, 12:05pm UTC](https://devforum.okta.com/t/invalid-client-client-authentication-failed-spa/8043 "2020-02-11T12:05:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![deck1187hw](https://avatars.discourse-cdn.com/v4/letter/d/7cd45c/32.png) [@deck1187hw](https://devforum.okta.com/u/deck1187hw)\
**Post date:** [February 11, 2020, 12:05pm UTC](https://devforum.okta.com/t/invalid-client-client-authentication-failed-spa/8043/1 "2020-02-11T12:05:55Z")

</div>

Hi,  
I’m trying to make my SPA working. Im using this one:

> <https://github.com/okta/samples-js-vue/tree/master/okta-hosted-login>
>
> //github.com/okta/samples-js-vue/tree/master/okta-hosted-login

After log in from Okta ui to issue the token I get:

> {“error”:“invalid\_client”,“error\_description”:“Client authentication failed. Either the client or the client credentials are invalid.”}

I followed step by step the documentation.

This is the request I’m doing:

> curl ‘[https://nandos.okta.com/oauth2/default/v1/token](https://nandos.okta.com/oauth2/default/v1/token)’ -H ‘authority: [nandos.okta.com](http://nandos.okta.com)’ -H ‘accept: application/json’ -H ‘x-okta-user-agent-extended: @okta/okta-vue/1.1.1 okta-auth-js-2.7.0’ -H ‘user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_15\_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36’ -H ‘content-type: application/x-www-form-urlencoded’ -H ‘origin: [http://localhost:8080](http://localhost:8080)’ -H ‘sec-fetch-site: cross-site’ -H ‘sec-fetch-mode: cors’ -H ‘referer: [http://localhost:8080/implicit/callback](http://localhost:8080/implicit/callback)’ -H ‘accept-encoding: gzip, deflate, br’ -H ‘accept-language: en,en-US;q=0.9,es;q=0.8,ru;q=0.7,it;q=0.6,pt;q=0.5,de;q=0.4,gl;q=0.3,fr;q=0.2’ --data ‘client\_id=xxxxxx&redirect\_uri=http%3A%2F%2Flocalhost%3A8080%2Fimplicit%2Fcallback&grant\_type=authorization\_code&code=xxxxxxx&code\_verifier=ce978da81d8fc55exxxef2779045343605e2a24fbc’ --compressed

And My config looks like this:

 ![Screenshot 2020-02-11 at 12.05.09](https://global.discourse-cdn.com/oktadev/original/2X/e/e173aa906fa8915f119e3d26ce565a7d21905e9e.png)

I’m pretty sure I’m missing some silly thing…

appreciate any help.

Thanks!

---

<div class="post-metadata">

**Author:** ![Rakeshrajagopal](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@Rakeshrajagopal](https://devforum.okta.com/u/Rakeshrajagopal)\
**Post date:** [February 12, 2020, 12:18pm UTC](https://devforum.okta.com/t/invalid-client-client-authentication-failed-spa/8043/2 "2020-02-12T12:18:04Z")

</div>

Hi @deck1187hw,

Application created for the Web application integration rather than SPA. In case of Web application, configuration will be with ClientID and Client Secret. Hence you need to pass the ClientID and Client Secret in the Authorization Header while invoking the token endpoint. In case of SPA, you will be passing the Code\_Challange in Authorization endpoint and Code\_verifier in the Token endpoint.

 ![okta_support](https://global.discourse-cdn.com/oktadev/original/2X/d/d1da1490f0ad82385feb44a0be4f1c89ef545243.png)

---

<div class="post-metadata">

**Author:** ![bro](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@bro](https://devforum.okta.com/u/bro)\
**Post date:** [August 31, 2020, 12:12am UTC](https://devforum.okta.com/t/invalid-client-client-authentication-failed-spa/8043/3 "2020-08-31T00:12:16Z")

</div>

They don’t make this obvious at all. What you need to do is the following:

[https://developer.okta.com/docs/reference/api/oidc/#client-secret](https://developer.okta.com/docs/reference/api/oidc/#client-secret)  
Authorization: Basic ${Base64(\<client\_id\>:\<client\_secret\>)}

You can generate this from the command line like this:

echo -n ‘\<client\_id\>:\<client\_secret\>’ | openssl base64

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [January 3, 2024, 6:40pm UTC](https://devforum.okta.com/t/invalid-client-client-authentication-failed-spa/8043/4 "2024-01-03T18:40:46Z")

</div>

Closed on January 3, 2024, 6:40pm UTC


