Issue with Client_Credential using OAuth2

Hi,

I am trying to use the following url to generate a access token with the following uRL:

curl -X POST -H “Content-Type: application/x-www-form-urlencoded” \ https://XXXXXX-eval-test.apigee.net/oauth/client_credential/accesstoken?grant_type=client_credentials \ -d ‘client_id=19TGrhCeCCE6oT18Wz5YoJnFTzUDrfyl &client_secret=u0r1c5vvdlCqTfvA’

but getting the below error:

{“ErrorCode” : “invalid_client”, “Error” :“Client identifier is required”}‘client_secret’ is not recognized as an internal or external command, operable program or batch file.

Regards

Ramesh

Hey, please check your curl cmd. There is a whitespace before &client_secret

Hi,

We have tried removing the white space as well but with the same error.

curl -X POST -H “Content-Type: application/x-www-form-urlencoded” https://XXXXX-eval-test.apigee.net/oauth/client_credential/accesstoken?grant_type=client_credentials -d ‘client_id=19TGrhCeCCE6oT18Wz5YoJnFTzUDrfyl&client_secret=u0r1c5vvdlCqTfvA’

Please mention which document/link you are following.

https://docs.apigee.com/api-platform/tutorials/secure-calls-your-api-through-oauth-20-client-credentials

Well, nothing is wrong with the docs. If you followed all steps, then the curl should work.

If you are trying to call the curl in windows machine, try using double quotes instead of single quotes.

curl -X POST -H "Content-Type: application/x-www-form-urlencoded" "https://xxxxxxxxxxxxx-eval-test.apigee.net/oauth/client_credential/accesstoken?grant_type=client_credentials" -d "client_id=xxxxxxxxxxxxxxx&client_secret=xxxxxxxxxxxxxxxxxxx"

@0dede39b90d843479940007829ed46fa ,

Here is the 4 Minute Video Apigee - 4MV4D - Secure your APIs using OAuth 2.0 Client Credentials Grant Type that exactly showcases same step by step.


Anil Sagar


5997-screen-shot-2017-11-23-at-75916-pm.png
Learn Apigee Concepts in 4 Minutes HandsOn