I have the following OAuthv2.0 Generate Token Policy (which is attached to the response of the proxy endpoint flow because I get a JWT back from the target endpoint, I then validate&verify the JWT and i'm trying to now store it in an apigee token):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <OAuthV2 async="false" continueOnError="false" enabled="true" name="OAuthGenerateToken"> <DisplayName>OAuth.GenerateToken</DisplayName> <Attributes/> <ClientId>response.header.client_id</ClientId> <ExternalAccessToken>oauth.access_token</ExternalAccessToken> <ExternalAuthorization>true</ExternalAuthorization> <Operation>GenerateAccessToken</Operation> <SupportedGrantTypes> <GrantType>client_credentials</GrantType> </SupportedGrantTypes> <GrantType>client_credentials</GrantType> <GenerateResponse enabled="true"> <Format>FORM_PARAM</Format> </GenerateResponse> <ReuseRefreshToken>false</ReuseRefreshToken> <StoreToken>true</StoreToken> <Tokens/> </OAuthV2>
What I can't figure out is why this policy still generates this error:
{"ErrorCode":"invalid_client","Error":"Client identifier is required"}
In this case
response.header.client_id
is populated to a valid value (it shows up as being read in the trace), but it seems that policy isn't using the ClientId element to make the check that is associated with the error (I've tried with various other flow variables as well, none seem to work).
The only way I can get rid of the above error is to use this on the request flow and have the request be a x-www-form-urlencoded with a formparam named "client_id" (which has the same value that I have in "response.header.client_id now"). My understanding is that I can use the ClientId directive to override this default location, but so far I have been unsuccessful.
Any help is appreciated, Thanks!
Solved! Go to Solution.
As informed to you over email, you need to do the following.
This should help you to resolve the problem.
Regards,
Amar