Getting Raise Fault executed with variables in condition

I am trying to integrate with Okta for authentication and I am getting success from Okta.

Once i get success I an generating OAuth token in Apigee to send back to the client application.

If i get authentication failed form Okta I am raising Fault. The issue is my raise fault is getting executed even if Okta sends success. Reason could be the vars i am checking may not be set properly and do not see them anywhere in trace.

Attaching the proxy revision. Please help. I am new to Apigee learning these days.

Thanks

oauth-okta-rev2-2019-08-16.zip

0 6 169
6 REPLIES 6

sidd-harth
Participant V

Where are you setting this okta.token.status variable?

okta.token.status == null

If apigee doesnt find the flow variable, by default it is going to take it as null and hence the condition is a match and Raise fault is executed.

Thanks Siddhartha, for taking time to review this.

I tried changing them to read from apigee.status which are being set in Extract Variables policy, but it did not make a difference.

Show the trace where you observe that apigee.status is being set. If possible attach the downloaded trace file.

I could not find the apigee.status set in the trace, and not sure why it is not being set. Per the code it should have been set as it got the response back from the auth server(there in the service callout response shown in trace file). Attaching the trace file.

trace-1566223290502.zip

I did not check your Trace xml.

But I guess the issue is with your Extract Policy. You are trying to extract variables from Service callout response, so the Source element in extract variable policy should be changed from request to,

<Source clearPayload="false">calloutResponse.content</Source>

You were correct. That was the issue and it worked after changing it as mentioned.

Thanks Everyone for your help.