Search code examples
oauth-2.0jwtpostmanauthorizationidentityserver4

OAuth2.0 works from Postman UI (authorization helper), doesn’t work via manual request


The issue I’m facing is I’m trying to manually get the token from the API for the sake of automation. What I did is I configured IdentitySever to grant token on user credentials it worked fine when request has been sent via OAuth UI: enter image description here

I’m getting the following request/response (viewed in console): enter image description here

Now the issue is that I’m sending the exact same request but manually, but it fails: enter image description here

I'm getting 'invalid_client' error instead of Token I'm not overriding IResourceOwnerPasswordValidator so I'm using default implementation. Anything else that I’m missing? Does UI do something else under the hood? Did I miss something?

The requests are identical, I copied over clients, passwords etc in case anything is different. I’ve also tried to do the token request via get+query string, but same result

I tried changing the clientid, clientsecret, but no luck so far


Solution

  • There's a typo in your manual request. It should be 'client_secret' but not 'cliend_secret'.

    OAuth2 doesn't understand this field and as a result of this, it assumes that you didn't pass the secret of the client in the request and thus it throws an 'invalid_client' error.

    enter image description here