Solved Solved

Fault handling for OAuth proxy for UnSupportedGrantType

anuprai
Participant IV

Hi,

I am trying to convert the default error structure of OAuth proxy to custom format. This OAuth proxy has only GenerateAccessToken policy for client_credentials grant type.

When an invalid grant type is passed then Apigee returns below error -

{"ErrorCode" : "invalid_request", "Error" :"Unsupported grant type : client_credential"}

I have given <GenerateResponse> to false to generate custom response.

When an invalid grant type is passed flow is now entering to Fault rule. As per Apigee documentation there is currently a bug where unsupported grant type errors are not thrown correctly. Is there a workaround for this so that flow should execute Fault Rules?

Also "fault.name" variable is not getting created in this case. What could be the reason for this?

I can see "oauthV2.failed" variable is getting set to true but other fault variables are not coming.

Thanks,

Anup Rai

Solved Solved
0 1 48
1 ACCEPTED SOLUTION
Solved Solved

jaupadhyay
Participant IV
@Anup Rai

One way of solving this issue is to check the value of grant type using Javascript ( I presume it's either coming as Query Parameter or Request header ) in PreFlow. If value is not as you are expecting use RaiseFault policy and write your own custom error message. So essentially you don't need to invoke OAuthV2 policy for GenerateAccessToken operation if grant type value is not as expected.

Regards

Jayesh

View solution in original post

Solved Solved
1 0 2
1 REPLY 1
Solved Solved

jaupadhyay
Participant IV
@Anup Rai

One way of solving this issue is to check the value of grant type using Javascript ( I presume it's either coming as Query Parameter or Request header ) in PreFlow. If value is not as you are expecting use RaiseFault policy and write your own custom error message. So essentially you don't need to invoke OAuthV2 policy for GenerateAccessToken operation if grant type value is not as expected.

Regards

Jayesh

View solution in original post

Solved Solved
1 0 3
Top Labels in this Space
Top Solution Authors