I am trying week6 hands on for OAuth2 policy and getting an error on Grant type while deployment. This is when I replace the default content for validation with GenerateAuthorizationCode operation.

when I configure OAuth2 policy for GenerateAuthorizationCode with below XML as given in the video

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <OAuthV2 async="false" continueOnError="false" enabled="true" name="OAuth-v20-1"> <DisplayName>OAuth v2.0 1</DisplayName> <FaultRules/> <Properties/> <Attributes/> <ExternalAuthorization>false</ExternalAuthorization> <Operation>GenerateAuthorizationCode</Operation> <ExpiresIn>864000</ExpiresIn> <SupportedGrantTypes> <GrantType>client_credentials</GrantType> </SupportedGrantTypes> <GrantType>request.queryparam.grant_type</GrantType> <GenerateResponse/> <Tokens/> </OAuthV2>

I am getting an error

Error while Uploading file for API JokeOAuth. Grant types are not applicable for operation OAuth-v20-1

Please help !!

Solved Solved
0 5 616
1 ACCEPTED SOLUTION

Voila !!

It somehow worked today, the same XML, when I saved it accepted it. Not sure someone else faced this issue. Now when i pass the grant_type as client_credentials i got the token as well.

View solution in original post

5 REPLIES 5

Not applicable

The problem may be an extraneous grant type in your XML. Try removing <GrantType>request.queryparam.grant_type</GrantType>

and see if that fixes the problem. I don't believe you need that extra grant type for the exercise, but if you do, put it in between <SupportedGrantTypes> and </SupportedGrantTypes>.

Hi Mike ,

Thanks for the reply, it worked !!

However it will be useful if the if APIGEE can correct the tutorial video by Mike Bissel(Week6_4_Client_Credentials).

But when I fire request http://{orgname}/v1/oauth/token?grant_type=client_credentials

I get error

HTTP/1.1 400 Bad Request Content-Length: 73 { "ErrorCode": "invalid_request", "Error": "Required param : grant_type" }

Now my policy XML look like below

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <OAuthV2 async="false" continueOnError="false" enabled="true" name="OAuth-v20-1"> <DisplayName>OAuth v2.0 1</DisplayName> <FaultRules/> <Properties/> <Attributes/> <ExternalAuthorization>false</ExternalAuthorization> <Operation>GenerateAccessToken</Operation> <ExpiresIn>86400</ExpiresIn> <SupportedGrantTypes> <GrantType>client_credentials</GrantType> </SupportedGrantTypes> <GenerateResponse/> </OAuthV2>

I also tried to give <GrantType>request.queryparam.grant_type</GrantType> inside <SupportedGrantTypes> but proxy is not getting saved dueo to error "Invalid grant type: request.queryparam.grant_type"

Please help.

Voila !!

It somehow worked today, the same XML, when I saved it accepted it. Not sure someone else faced this issue. Now when i pass the grant_type as client_credentials i got the token as well.

It look like a random issue with developer version.