All,
Sorry for probably aksing a newbie question, but I'm getting mad after having tried to generate an access token now for hours or days, I've forgotten to track the time 🙂
I always get this message:
{"ErrorCode" : "invalid_client", "Error" :"Client identifier is required"}
And I currently using this GET
And yes, I've read and watched all the tutorials and encoded the values and tried them as authorization header and as parameters and and as POST and as a GET.
Always the same message and no idea where to getting more details.
Thanks for your help!
Olli
Solved! Go to Solution.
Hey Oliver,
Looking at your encoded string, I think what you did was to encode each of the consumer key and consumer secret individually and then just concatenated them. What you need to do, is to concatenate first, and then encode.
what you did:
encode(username) + ':' + encode(password)
What you need:
encode(username + ':' + password)
That is pseudo-code of course.
The following should work for you:
curl -v "http://mobinauten-test.apigee.net/v1/oauth/token?grant_type=client_credentials" \ -X GET \ -H 'Authorization: Basic bHVJTEpHTklld2ticTRiWGtiN3J3VXJIdnpiZzVWWG06V0N2eUtOVXlBYmIwYzVHQQ=='
Let me know, how it goes. Have fun with Apigee.
Argo
Hey Oliver,
Looking at your encoded string, I think what you did was to encode each of the consumer key and consumer secret individually and then just concatenated them. What you need to do, is to concatenate first, and then encode.
what you did:
encode(username) + ':' + encode(password)
What you need:
encode(username + ':' + password)
That is pseudo-code of course.
The following should work for you:
curl -v "http://mobinauten-test.apigee.net/v1/oauth/token?grant_type=client_credentials" \ -X GET \ -H 'Authorization: Basic bHVJTEpHTklld2ticTRiWGtiN3J3VXJIdnpiZzVWWG06V0N2eUtOVXlBYmIwYzVHQQ=='
Let me know, how it goes. Have fun with Apigee.
Argo
Based on this feedback (and very sorry for the trouble you had, Oliver) I updated our doc topic on client credentials so that is much more clear how to make a token request using either straight client_id/secret values or the base64 encoded auth:
http://apigee.com/docs/api-services/content/oauth-20-client-credentials-grant-type
Olli, sorry about the frustration. Arghya, thanks a ton for the troubleshooting. FYI that I've added a troubleshooting link to this post from the OAuth error reference docs:
http://apigee.com/docs/api-services/reference/oauth-error-code-reference
thanks for adding that. It's especially confusing since if you look at the OAuth authorization server proxy it has request.queryparam.client_id as the location of the client_id. I'd suggest updating documentation here ...
I am also getting similar error .
I used postman to port the below url
In body I have given client_id = p2uysRmX7FCjSVTypcx2ZA8DIxQrs0nI and client_secret = AxZiSF4aXjRrWOX2
giving an error {"ErrorCode" : "invalid_client", "Error" :"Client identifier is required"}
Not sure what is the issue.
I am sorry it was my mistake ...
tried with apikey= p2uysRmX7FCjSVTypcx2ZA8DIxQrs0nI in header along with cliend_id and client_secret in body and it worked.
I'm glad you got it sorted. In the future, please just create a new question, rather than asking a new question as an "Answer" or a "Comment" attached to an old question.
I also had same error but fortunately I came to know was passing `client_id` and `client_secret` as `form-data` instead `x-www-form-urlencoded` thus was giving me this error `{"ErrorCode" : "invalid_client", "Error" :"Client identifier is required"}`.
Thanks for the clear explanation on http://docs.apigee.com/tutorials/secure-calls-your-api-through-oauth-20-client-credentials, helped me to set my first OAuth enabled API.
You should try calling api in this way :
Oauth takes input in x-www-form-urlencoded to provide variety of input in form data.
Refer APigee Docs below:
GenerateAccessToken OAuthv2.0e
curl -X POST \ 'http://mobinauten-test.apigee.net/v1/oauth/token?grant_type=client_credentials' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -H 'Postman-Token: 43b234f6-cb49-48e9-ae8d-dacd19b5c51c' \ -H 'cache-control: no-cache' \ -d 'client_id=bHVJTEpHTklld2ticTRiWGtiN3J3VXJIdnpiZzVWWG0&client_secret=V0N2eUtOVXlBYmIwYzVHQQ&undefined='