GenerateAccessTokenClient 401 Unauthorized while generating access token oauth2

akavikadu
Participant I

with 2 body parameter : client_id and client_secret, but I am reviving "Could not get any response"

Proxy is working , in trace window i am getting "GenerateAccessTokenClient 401 Unauthorized" for same request.

Solved Solved
0 5 1,324
1 ACCEPTED SOLUTION

Normally the client_id and client_secret are passed in the Authorization header, and the grant_type is passed as a body param. So the curl command would look like this:

curl -X POST -u client_id:client_secret -d 'grant_type=client_credentials' https://org-env.apigee.net/oauth/client_credentials/token

That's the normal case. Try it. If it does not work, then your API Proxy may be expecting something different. We cannot tell unless you show us the proxy flow and the GenerateAccessToken policy.

View solution in original post

5 REPLIES 5

akavikadu
Participant I

@Avinash Kadu,

Please share the following information so that we can help you on how to resolve the issue:

1. What is the complete error message observed (share the screenshot if possible) ?

2. Have you passed the correct values for the client_id and client_secret ? Are you passing them as form parameters ? Is that where the GenerateAccessToken policy expecting them to be passed ?

Issue is solved , I was trying to pass parameter in header.

Normally the client_id and client_secret are passed in the Authorization header, and the grant_type is passed as a body param. So the curl command would look like this:

curl -X POST -u client_id:client_secret -d 'grant_type=client_credentials' https://org-env.apigee.net/oauth/client_credentials/token

That's the normal case. Try it. If it does not work, then your API Proxy may be expecting something different. We cannot tell unless you show us the proxy flow and the GenerateAccessToken policy.

I have pass this parameter as body parameter and it works for me.