0

Is it possible to create a custom policy to reset passwords at the member activation step without entering the activation code?

I am creating a user using Graph API and sending an invitation email to the specified email address with extension_activationCode claim as a token.

    var emailClaim = new Claim("email", email);
                var codeClaim = new Claim("extension_ActivationCode", activationCode);
                policyClaims.Add(emailClaim);
                policyClaims.Add(codeClaim);

I want the user to click on the link in that email and just set a password for his account. Currently, the UI is auto-populating the code and showing the Continue button so that the user can click it.

    <UserJourney Id="MemberActivationDYP">
          <PreserveOriginalAssertion>false</PreserveOriginalAssertion>
          <OrchestrationSteps>           
            <OrchestrationStep Order="1" Type="ClaimsExchange" ContentDefinitionReferenceId="api.localaccount.activation">        
              <ClaimsExchanges>
                <ClaimsExchange Id="LocalAccountPasswordRecoveryVerifiedEmailExchange" TechnicalProfileReferenceId="LocalAccount-ActivationDYP" />
              </ClaimsExchanges>
            </OrchestrationStep>            
            <OrchestrationStep Order="2" Type="ClaimsExchange">
               <Preconditions>
                <Precondition Type="ClaimsExist" ExecuteActionsIf="false">
                  <Value>objectId</Value>
                  <Action>SkipThisOrchestrationStep</Action>
                </Precondition>
              </Preconditions>
              <ClaimsExchanges>
                <ClaimsExchange Id="AAD-UserReadUsingObjectIdExchange" TechnicalProfileReferenceId="AAD-UserReadUsingObjectId" />
              </ClaimsExchanges>
            </OrchestrationStep>

    <TechnicalProfile Id="LocalAccount-Activation">
              <DisplayName>Account Activation</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.localaccount.activation</Item>
                <Item Key="IpAddressClaimReferenceId">IpAddress</Item>
              </Metadata>
              <CryptographicKeys>
                <Key Id="issuer_secret" StorageReferenceId="B2C_1A_TokenSigningKeyContainer" />
              </CryptographicKeys>
              <IncludeInSso>false</IncludeInSso>
              <InputClaims>
                <InputClaim ClaimTypeReferenceId="email" />
                <InputClaim ClaimTypeReferenceId="extension_activationCode" />
              </InputClaims>
              <OutputClaims>
                <OutputClaim ClaimTypeReferenceId="signInNames.emailAddress" Required="true" />
                <OutputClaim ClaimTypeReferenceId="extension_activationCode" Required="true" />         
                <OutputClaim ClaimTypeReferenceId="objectId" />
                <OutputClaim ClaimTypeReferenceId="userPrincipalName" />
                <OutputClaim ClaimTypeReferenceId="extension_isAccountActivated" />
              </OutputClaims>
              <ValidationTechnicalProfiles>
                <ValidationTechnicalProfile ReferenceId="AAD-UserReadUsingEmailAddress" />
              </ValidationTechnicalProfiles>
            </TechnicalProfile>
            
            <TechnicalProfile Id="LocalAccount-ActivationDYP">
              <DisplayName>Member Portal Account Activation</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.localaccount.activation</Item>
                <Item Key="IpAddressClaimReferenceId">IpAddress</Item>
              </Metadata>
              <CryptographicKeys>
                <Key Id="issuer_secret" StorageReferenceId="B2C_1A_TokenSigningKeyContainerCRM" />
              </CryptographicKeys>
              <IncludeInSso>false</IncludeInSso>
              <InputClaims>
                <InputClaim ClaimTypeReferenceId="email" />
                <InputClaim ClaimTypeReferenceId="extension_activationCode" />
              </InputClaims>
              <OutputClaims>
                <OutputClaim ClaimTypeReferenceId="signInNames.emailAddress" Required="true" />
                <OutputClaim ClaimTypeReferenceId="extension_activationCode" Required="true" />         
                <OutputClaim ClaimTypeReferenceId="objectId" />
                <OutputClaim ClaimTypeReferenceId="userPrincipalName" />
              </OutputClaims>
              <ValidationTechnicalProfiles>
                <ValidationTechnicalProfile ReferenceId="AAD-UserReadUsingEmailAddress-WithCodeDYP" />
              </ValidationTechnicalProfiles>
            </TechnicalProfile>
            <TechnicalProfile Id="AAD-UserReadUsingEmailAddress-WithCodeDYP">
              <Metadata>
                <Item Key="Operation">Read</Item>
                <Item Key="RaiseErrorIfClaimsPrincipalDoesNotExist">true</Item>
                <Item Key="UserMessageIfClaimsPrincipalDoesNotExist">An account could not be found for the provided user ID.</Item>
              </Metadata>
              <IncludeInSso>false</IncludeInSso>
              <InputClaims>
                <InputClaim ClaimTypeReferenceId="email" PartnerClaimType="signInNames" Required="true" />
                <InputClaim ClaimTypeReferenceId="extension_activationCode" Required="true" />
              </InputClaims>
              <OutputClaims>
                <!-- Required claims -->
                <OutputClaim ClaimTypeReferenceId="objectId" />
                <OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="localAccountAuthentication" />
                <!-- Optional claims -->
                <OutputClaim ClaimTypeReferenceId="userPrincipalName" />
                <OutputClaim ClaimTypeReferenceId="displayName" />
                <OutputClaim ClaimTypeReferenceId="otherMails" />
                <OutputClaim ClaimTypeReferenceId="signInNames.emailAddress" />
                <OutputClaim ClaimTypeReferenceId="extension_TermsOfUseConsented" />
                <OutputClaim ClaimTypeReferenceId="extension_shareDataWithTP" />
                <OutputClaim ClaimTypeReferenceId="extension_isAccountActivated" />
              </OutputClaims>
              <IncludeTechnicalProfile ReferenceId="AAD-Common" />
            </TechnicalProfile>

I want to hide the activation code step UI but dont want to skip this step.

Is there a way to hide from user this step?

basquiatraphaeu
  • 525
  • 7
  • 19
Muthukumar
  • 21
  • 4

1 Answers1

0

Yes - you can do this via a magic link.

Essentially you put the email address in a signed token to tell B2C whose password to reset.

Note the new way to do this is via id_token_hint.

rbrayb
  • 46,440
  • 34
  • 114
  • 174