azure-ad-b2c / samples

Azure AD B2C custom policy solutions and samples.
837 stars 596 forks source link

custom email validation with sendblue error #423

Open flieks opened 2 years ago

flieks commented 2 years ago

Hi, I am trying to get custom email validation working with sendInBlue.

I am getting this error in the UI when clicking send verification code

The claims exchange 'SendOtp' specified in step '2' returned HTTP error response with Code 'BadRequest' and Reason 'Bad Request'.

and this in appInsights

Exception Message:A content definition data uri is required. Orchestration step '2' of user journey 'SignUpOrSignIn' in policy 'B2C_1A_signup_signin' does not reference one nor does one of its referenced technical profiles., Exception Type:PolicyException, CorrelationID:xxxxx

My orchestration step:

 <OrchestrationStep Order="2" Type="ClaimsExchange">
          <Preconditions>
            <Precondition Type="ClaimsExist" ExecuteActionsIf="true">
              <Value>objectId</Value>
              <Action>SkipThisOrchestrationStep</Action>
            </Precondition>
          </Preconditions>
          <ClaimsExchanges>
            <ClaimsExchange Id="SignUpWithLogonEmailExchange" TechnicalProfileReferenceId="LocalAccountSignUpWithLogonEmail" />
          </ClaimsExchanges>
        </OrchestrationStep>

The LocalAccountSignUpWithLogonEmail:

       <TechnicalProfile Id="LocalAccountSignUpWithLogonEmail">
         <DisplayName>Email signup</DisplayName>
         <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />

          <Metadata>
            <Item Key="IpAddressClaimReferenceId">IpAddress</Item>
            <Item Key="ContentDefinitionReferenceId">api.localaccountsignup</Item>
          </Metadata>
          <CryptographicKeys>
            <Key Id="issuer_secret" StorageReferenceId="B2C_1A_TokenSigningKeyContainer" />
          </CryptographicKeys>
          <DisplayClaims>
            <DisplayClaim DisplayControlReferenceId="emailVerificationControl" />
            <DisplayClaim ClaimTypeReferenceId="newPassword" Required="true" />
            <DisplayClaim ClaimTypeReferenceId="reenterPassword" Required="true" />
          </DisplayClaims>

          <ValidationTechnicalProfiles>
            <ValidationTechnicalProfile ReferenceId="AAD-UserWriteUsingLogonEmail" />
          </ValidationTechnicalProfiles>

          <UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />

      </TechnicalProfile>

Gist with complete code from TrustFrameworkBase gist

JasSuri commented 2 years ago

This is better posted on stackoverflow, as this is a config issue with your API call. Either you have incorrect api key or incorrectly formed json body.

flieks commented 2 years ago

@JasSuri what about the above error ? Exception Message:A content definition data uri is required. Orchestration step '2' of user journey 'SignUpOrSignIn' in policy 'B2C_1A_signup_signin' does not reference one nor does one of its referenced technical profiles., Exception Type:PolicyException, CorrelationID:xxxxx It insinuates that there is a problem with the XML config of the TrustFrameworkBase I have a gist here

JasSuri commented 2 years ago

I don’t see an issue with the content defs. That error would not trigger on the action of sending otp code. Your other error of bad request from api call on click of send code, is directly related to the action. Investigate the api call.