If something goes wrong with B2C internally, you get this message.
(BTW, if you want to brand this page you need to use the “ContentDefinition” for “api.error”).
The question is how to generate an error page from the custom policy itself.
The first problem is that to show the user a message you need a screen and in B2C that’s called a self-asserted flow — one in which the user is expected to provide input.
It follows then that this screen has to have at least one input element e.g. a textbox. So you could have:
Then you have to input a valid email address and click “Continue” and then you see:
The error message uses e.g.
<Item Key=”UserMessageIfClaimsTransformationBooleanValueIsNotEqual”>This is an error message to display on the screen</Item>
as in this article.
That is definitely not a good user experience!
What we really want is something like this:
We can do this via the “Paragraph” user input type, described here.
I’ve put the bits and pieces to do this in the gist.
- Define a claim type of “errorMessage”
- Define the text of the error message for this claim type
- Define a self-asserted technical profile to display the error “SelfAsserted-Error”
- This TP removes the “Continue” and “Cancel” buttons
- Define an InputClaimsTransformation to add the error text
- Define an OrchestrationStep with a precondition to define when the error message should be displayed
And that’s pretty much it.
If e.g. you wanted to have the “Cancel” button and the user clicked on it, you would see:
#error=access_denied&error_description=AADB2C90091 The user has cancelled entering self-asserted information