如何在自定义 Azure AD B2C SignUpOrSignin 策略上启用 Javascript

How to enable Javascript on Custom Azure AD B2C SignUpOrSignin Policy

我正在尝试在我的自定义 "SignUpOrSignin.xml" 策略中启用 Javascript,这样我就可以在“重置密码”和“注册”按钮上执行自定义操作。

我在 SignUpOrSignin.xml 上执行了以下步骤:

 <RelyingParty>
<DefaultUserJourney ReferenceId="SignUpOrSignIn" />
<UserJourneyBehaviors>
  <ScriptExecution>Allow</ScriptExecution>
</UserJourneyBehaviors>
 .........
 .........
 .........
</RelyingParty>

以及 TrustFrameworkBase.xml:

 <ContentDefinition Id="api.signuporsignin">
    <LoadUri>https://ttt.blob.core.windows.net/b2c-migration-users/pages/unified.html</LoadUri>
    <RecoveryUri>~/common/default_page_error.html</RecoveryUri>
    <DataUri>urn:com:microsoft:aad:b2c:elements:unifiedssp:1.1.0</DataUri>
    <Metadata>
      <Item Key="DisplayName">Signin and Signup</Item>
      <Item Key="TemplateId">azureBlue</Item>
    </Metadata>
  </ContentDefinition>

不幸的是,当我尝试在 AAD B2C 实例中上传 SignUpOrSignin.xml 策略时,我收到以下验证错误:

Validation failed: 1 validation error(s) found in policy "B2C_1A_JITMIGRAION_SIGNUP_SIGNIN" of tenant "mytenant.onmicrosoft.com". Please use page contract in content definitions when enabling JavaScript.

我错过了什么?任何帮助将不胜感激!

对于任何要启用 JS 的 ContentDefinitionDataUri 需要是合同版本。这意味着 urn:com:microsoft:aad:b2c:elements:unifiedssp:1.1.0 需要更改为 urn:com:microsoft:aad:b2c:elements:contract:unifiedssp:1.2.0(参见 Content Definitions Documentation). The page layout version is also different, and you can see what those differences are by going here