V1/token is returning 401 unauthorized

I am trying to implement the Authorization code PKCE flow in my angular application

Here is how my /Authorize call looks like


In the redirect I get the Authorization_code back


When the /token call goes out to get the access token I keep getting 401 unauthorized error not sure why.

the error is:
{“error”:“invalid_client”,“error_description”:“No client credentials found.”}

and the parameters are going with the post request

grant_type: authorization_code
code: 6og7fphNBXShxxxxxx
redirect_uri: http://localhost:4200/login
code_verifier: _V-RkYs5k73YWAYGcRL5eV2iyxxxxxxxxoGK
client_id: 0oap5zbsyzbH1xxxxxxxx

I have SPA application setup. Not sure if this is the correct application setup in okta for this workflow to work? Can you please point me to the right direction?
here is a screen shot of my OKTA app

Hi @jelbatnigi

The request looks correct, however the 401 means that Okta could not read the values provided. Can you please let me know what is the format in which you are sending the payload to the /token endpoint (application/x-www-form-urlencoded, application/json, etc.)?

Hi dragos,
I just found out the problem. I am using an interceptor in my app so I can intercept any http call and attach the Bearer token in my header for autherization with my APIs.
so the /token call was getting intercepted and adding “Authorization: Bearer null” to the header causing it to fail.
now I need to make sure I intercept the right calls.


hi @jelbatnigi so i have the same please problem, please help me share how can you solve it?

did you get the solution?

There is an Angular sample app that demonstrates using an interceptor. In this case the interceptor only adds the headers for specific routes.