Javascript is disabled on the Client Side, even though i have added below as per documentation.
<RelyingParty>
<DefaultUserJourney ReferenceId="B2CSignUpOrSignInWithPassword" />
<UserJourneyBehaviors>
<ScriptExecution>Allow</ScriptExecution>
</UserJourneyBehaviors>
...
</RelyingParty>
When i try to upload the Custom Policy, i get an error - "Please use page contract in content definitions when enabling JavaScript." Cannot find anything related to this error in documentation.
Tried to add metadata to content definitions, using datauri -
<ContentDefinition Id="api.localaccountpasswordreset">
<RecoveryUri>~/common/default_page_error.html</RecoveryUri>
<DataUri>urn:com:microsoft:aad:b2c:elements:contract:selfasserted:1.1.0</DataUri>
...
</ContentDefinition>
Expect javascript to work on client side login pages
In the Azure portal, search for and select Azure AD B2C. In the left-hand menu, select User flows, and then select the B2C_1_signupsignin1 user flow. Select Page layouts, and then under Unified sign-up or sign-in page, select Yes for Use custom page content. In Custom page URI, enter the URI for the custom-ui.
Register a web application using the Azure portal so you'll be able to test your policy. Add the necessary policy keys and register the Identity Experience Framework applications. Get the Azure AD B2C policy starter pack and upload to your tenant. After you upload the starter pack, test your sign-up or sign-in policy.
The Identity Experience Framework is a powerful identity engine with a very comprehensive feature set, that is used internally for Microsoft services like Azure AD B2C. Only a subset of features will be tested, monitored, documented, and supported over time. The supported list will increase quickly.
Azure AD B2C provides a set of packaged content containing HTML, CSS, and JavaScript for the user interface elements in your user flows and custom policies. To enable JavaScript for your applications: Select a page layout Enable it on the user flow by using the Azure portal
To enable JavaScript for your applications, you must add an element to your custom policy, select a page contract, and use b2clogin.com in your requests. Sorry, something went wrong. @mmacy thanks for you reply. Yay! I had a go with playing with b2clogin.com again and this time it worked successfully.
Adding JavaScript (JS) to the B2C UI customisation flow has been on the cards for a while and now has finally been released. I suggest you read through all the links below and then read through the post. There’s a good write-up here. Let’s follow the article. This is described here.
Select Upload custom policy. Upload the extensions file that you previously changed. Select the policy that you uploaded, and then select Run now. You should be able to sign up by using an email address. By using Azure AD B2C custom policies, you can send a parameter in the URL path, or a query string.
I facing the same problem, to correct I follow this steps(for custom policies):
First: in _Base.Xml go to ContentDefinitions and find for DataUri, change all old uris to new like this link https://docs.microsoft.com/en-us/azure/active-directory-b2c/contentdefinitions#migrating-to-page-layout
Second: ensure that you have the word "contract" between your elements and your page identifier, example: change this urn:com:microsoft:aad:b2c:elements:globalexception:1.2.0 for this urn:com:microsoft:aad:b2c:elements:contract:globalexception:1.2.0
Third: in your specific Custom Policie, find for RelyingParty and add the ScriptExecution element to the UserJourneyBehaviors element of RelyingParty
some like this
<RelyingParty>
<DefaultUserJourney ReferenceId="B2CSignUpOrSignInWithPassword" />
<UserJourneyBehaviors>
<ScriptExecution>Allow</ScriptExecution>
</UserJourneyBehaviors>
...
</RelyingParty>
Fourth: upload the base.xml, upload your custom policy.xml and enjoy!
greetings from Brasil.
If you are still facing the errors, then replace the DataUri
tag from
<DataUri>urn:com:microsoft:aad:b2c:elements:idpselection:1.2.0</DataUri>
to <DataUri>urn:com:microsoft:aad:b2c:elements:contract:providerselection:1.2.0</DataUri>
for the ContentDefinition
api.idpselections
and api.idpselections.signup
.
This article explains end to end how to enable javascript. https://docs.microsoft.com/en-us/azure/active-directory-b2c/javascript-samples
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With