2
votes

In Azure AD B2C custom policy, In a ValidationTechnicalProfile, while calling an external REST API, if the REST API returns HTTP error codes like 404 not found, or 401 unauthorized, the "ContinueOnError" attribute does not take effect. Instead the user journey ends abruptly throwing an error "Unable to validate the information provided" to the user interface in case of a self asserted technical profile. However the ContinueOnError attribute works as expected when the REST API returns error codes such as 400 Bad Request.

<ValidationTechnicalProfiles>
<ValidationTechnicalProfile ReferenceId="REST-API-PostUser" ContinueOnError="true" />

Why is the above not working for certain codes like 404 or 401? Is there any other ways in which we can handles these codes accordingly within the user journey?

1

1 Answers

1
votes

Rest API validation technical profile with B2C custom policy will work only with 200-ok, 400- Bad Request or 409 -Conflict HTTPStatus code. What I do is catch any error in the REST API controller, if it's written by your team and always throw 409, except for 200 and 400. If it's not written by your team there are two options: 1. Use an API manager (Many available in market) to wrap any other error code to 409 2. Develop your own Web API as wrapper on the third party API that you are calling and then capture any error and throw it back as 409. Read this: https://docs.microsoft.com/bs-latn-ba/azure/active-directory-b2c/restful-technical-profile#returning-error-message