'Custom B2C policy with custom TOTP fails validation with error: "Please use page contract in content definitions when enabling JavaScript"
I am working on a IEF Policy that supports custom TOTP. I am using the following sample code as basis for my work: https://github.com/azure-ad-b2c/samples/tree/master/policies/custom-mfa-totp
I have created the Service that supports the TOTP requests that IEF will issue based on the policy definitions.
My problem is I get the following error when uploading the IEF policy
Validation failed: 1 validation error(s) found in policy "myPolicyName" of tenant "myb2cTenant.onmicrosoft.com".
Please use page contract in content definitions when enabling JavaScript.Please use page contract in content definitions when enabling JavaScript.
To this point, I am basically just modifying the sample policy files to include the specific information to work within my system. The sample policy files are divided into two: TrustFrameworkExtensions.xml and SignUpOrSignIn.xml
Loading the Extension file works, but I get the previously mention error when attempting to load the SignUpOrSignIn file.
I have found a couple of other StackOverflow posts referring to similar errors and the recommended solution does not solve the problem. The recommended solution suggest updating the element with the corresponding value as described here:Content Definitions and making sure that the Relying party allows JS execution as described here Allow JS execution
After that this is what the ContentDefintion looks like for my Policy:
<ContentDefinition Id="api.selfasserted.appfactor.registration">
<LoadUri>https://myurl/totp-ui/selfasserted-appfactor-registration.html</LoadUri>
<RecoveryUri>~/common/default_page_error.html</RecoveryUri>
<DataUri>urn:com:microsoft:aad:b2c:elements:contract:selfasserted:1.2.0</DataUri>
<Metadata>
<Item Key="DisplayName">App Factor</Item>
</Metadata>
</ContentDefinition>
Even with these updates the Policy still fails to load, and I am out of things to try or even troubleshoot.
Any ideas about what may be the cause for that error?
Solution 1:[1]
With special thanks to Dale Kirby, I now have the solution to this problem.
The error was not caused by the configuration in this TechnicalProfile that is provided in the sample's TrustFrameworkExtensions.xml.
<TechnicalProfile Id="AppFactor-VerifyTotpWebHook" ->
The actual reason for me getting the error was that several of the -TechnicalProfile- elements referenced from my TrustFrameworkBase.xml file, had the old URI in their DataURI (These Technical-Profiles are referenced by the TrustFrameworkExtensions.xml provided in the sample).
Once I updated all the outdated -DataURI- values in the TrustFrameworkBase.xml and TrustFrameworkExtensions.xml the error went away. The correct URIs are listed here: Page layout URIs
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Diablo666 |
