简体   繁体   中英

Azure AD B2C string format claim

I want to send sms with one time password but the requirement is that in must be in sentence: "This is your one time code 123456, please confirm your account".

code generation:

 <TechnicalProfile Id="GenerateOtpSms">
      <DisplayName>OTP</DisplayName>
      <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.OneTimePasswordProtocolProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
      <Metadata>
        <Item Key="Operation">GenerateCode</Item>
        <Item Key="CodeExpirationInSeconds">1200</Item>
        <Item Key="CodeLength">6</Item>
        <Item Key="CharacterSet">0-9</Item>
        <Item Key="ReuseSameCode">false</Item>
        <Item Key="MaxNumAttempts">5</Item>
        <Item Key="NumCodeGenerationAttempts">5</Item>
      </Metadata>
      <InputClaims>
        <InputClaim ClaimTypeReferenceId="signInNames.phoneNumber" PartnerClaimType="identifier" />
      </InputClaims>
      <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="otpSms" PartnerClaimType="otpSmsGenerated" />
      </OutputClaims>

I've tried this:

  <ClaimsTransformation Id="CreateMessageTransformation" TransformationMethod="FormatStringClaim">
    <InputClaims>
      <InputClaim ClaimTypeReferenceId="otpSms" TransformationClaimType="inputClaim" />
    </InputClaims>
    <InputParameters>
      <InputParameter Id="stringFormat" DataType="string" Value="Use that code "{0} to..." />
    </InputParameters>
    <OutputClaims>
      <OutputClaim ClaimTypeReferenceId="text" TransformationClaimType="outputClaim" />
    </OutputClaims>

and the one with FormatStringMultipleClaims, but i keep getting "Unable to validate the information provided.". I've added <Item Key="ApplicationObjectId> and but it's not working.

Without CreateMessageTransformation, I am able to generate password, and send sms, but without the generated code.

Is there any other way to achieve "This is your one time code {otpSms}, please confirm your account"?

otpSms is type of string.

I believe that what you are looking for is possible.

A couple of things that might shed some light on this issue:

  • Based on the MSDN documentation , I thought the PartnerClaimType for the output on the GenerateOtpSms Technical Profile was supposed to be otpGenerated , not otpSmsGenerated
  • Can you share the claims definitions for otpSms and text ?
  • Where in your flow/journey are you "executing" the Claims transformation?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM