0
votes

I have a custom policy and we are doing a REST call to an API endpoint to do a value check. The API returns and I get the error message however it ejects/ stops the flow. From a customer point of view that is not what I am looking for.

I want to display the error message above where they entered the email address and not stop the flow.

I have the orchestration step to do the REST call working fine, but how do I get it to show a warning message instead of stopping the flow?

So an example:

In our reset password flow we are checking to see if the customer has a specific member flag in our database API.

This orchestration step is ran.

     <OrchestrationStep Order="2" Type="ClaimsExchange">
      <ClaimsExchanges>
        <ClaimsExchange Id="CheckMemberAccountHolder" TechnicalProfileReferenceId="REST-CheckMemberxAccountHolder" />
      </ClaimsExchanges>
    </OrchestrationStep>

And this is the Technical Profile

 <ClaimsProvider>
      <DisplayName>REST API to Check Member Account Holder</DisplayName>
      <TechnicalProfiles>
        <TechnicalProfile Id="REST-CheckMemberAccountHolder">
          <DisplayName>Rest API call to Check Member status</DisplayName>
          <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
          <Metadata>
            <Item Key="ServiceUrl">{API}</Item>
            <Item Key="SendClaimsIn">QueryString</Item>
            <Item Key="AuthenticationType">None</Item>
            <Item Key="AllowInsecureAuthInProduction">true</Item>
            <Item Key="DefaultUserMessageIfRequestFailed">Not an Active account</Item>
          </Metadata>
          <InputClaims>
            <InputClaim ClaimTypeReferenceId="email" PartnerClaimType="emailaddress"/>
          </InputClaims>
        </TechnicalProfile>
      </TechnicalProfiles>
    </ClaimsProvider>

When testing this in B2C it displays like this when the error happens. It is ejecting and showing the error. enter image description here

I would like it to display a message where all the other error messages do. just an example: enter image description here

Edit:

Ok i made the following changes.

<ClaimsProvider>
      <DisplayName>REST API to Check Member Status</DisplayName>
      <TechnicalProfiles>
        <TechnicalProfile Id="MemberAccountHolderCollector">
          <DisplayName>Verify member status</DisplayName>
          <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
          <Metadata>
            <Item Key="ContentDefinitionReferenceId">api.selfasserted.register</Item>
            <Item Key="setting.showContinueButton">No</Item>
          </Metadata>
            <OutputClaims>
            <OutputClaim ClaimTypeReferenceId="requireRegistration" DefaultValue="false" />
          </OutputClaims>
          <ValidationTechnicalProfiles>
            <ValidationTechnicalProfile ReferenceId="REST-CheckMemberAccountHolder" ContinueOnError="false"/>
          </ValidationTechnicalProfiles>
        </TechnicalProfile>

        <TechnicalProfile Id="REST-CheckMemberAccountHolder">
          <DisplayName>Rest API call to Check Member status</DisplayName>
          <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
          <Metadata>
            <Item Key="ServiceUrl">API</Item>
            <Item Key="SendClaimsIn">QueryString</Item>
            <Item Key="AuthenticationType">None</Item>
            <Item Key="AllowInsecureAuthInProduction">true</Item>
            <Item Key="DefaultUserMessageIfRequestFailed">You Did not say the Magic Word</Item>
          </Metadata>
          <InputClaims>
            <InputClaim ClaimTypeReferenceId="email" PartnerClaimType="emailaddress"/>
          </InputClaims>
        </TechnicalProfile>
      </TechnicalProfiles>
    </ClaimsProvider>
  </ClaimsProviders>

The orchestration step now calls the collection which will do the validation technical profile. The api.selfasserted.register reference goes to an HTML template.

This does it no matter what.. whether the API returns 200 or anything else.

Basically, I only want it to show this if it returns anything other than 200.

1
How would showing a warning message and not stoping the flow work? To show a message you need to stop any further steps executing. What specifically do you want to continue processing?Jas Suri - MSFT
@JasSuri-MSFT without getting into any major details, Basically we have a custom forgot password policy. This policy is doing an API call to verify something on the account before the password is reset, as we have different states the customer can be in. If they are in an "inactive" state basically i want to say their account is disabled and we cannot reset their password. Right now it ejects them from the flow, I just want a message to show up.Bnd10706
@JasSuri-MSFT i added some more information, hopefully, it clears things up.Bnd10706

1 Answers

1
votes

Call your REST API as a validation technical profile as part of a self asserted technical profile. Then the error from your API can be presented to the screen, as there is a page being rendered.

https://docs.microsoft.com/en-us/azure/active-directory-b2c/validation-technical-profile

<TechnicalProfile Id="LocalAccountSignUpWithLogonEmail">
          <ValidationTechnicalProfiles>
            <ValidationTechnicalProfile ReferenceId="AAD-UserWriteUsingLogonEmail" />
            <ValidationTechnicalProfile ReferenceId="REST-CheckMemberAccountHolder" />
          </ValidationTechnicalProfiles>
          <UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />
        </TechnicalProfile>