Reputation: 3
I'm trying to do sign-in and sign-up using Azure ad B2C in my project. For this I have created some user policies, and I am using a custom HTML for my sign up. My requirement is to execute some JavaScript after my sign-up page loads.
I have enabled JavaScript settings in Properties. Still I'm unable to find the scripts that I have placed in the HTML. Scripts are removed when the server loads the page, but if I run the option "Run userflow" in policies I am able to find the script and execute it. Are there some other settings that need to be changed or is this JavaScript enabling for custom policies only?
Policy properties:
Upvotes: 0
Views: 2194
Reputation: 158
I also ran into this exact same issue. To resolve it, make sure your application code is configured to use b2clogin instead of login.onmicrosoft, i.e. https://yourTenant.b2clogin.com
, for the authority.
Apparently, using login.onmicrosoft will strip away JavaScript from your custom UI. Not sure if this is documented anywhere, but this what worked for me. Apologies for not providing any concrete documentation on this.
In my particular scenario, I was using the MSAL library for NodeJS. Changed my configuration to the following (instance is what to look at here):
const instance = 'https://myTenant.b2clogin.com/tfp/';
const authority = `${instance}${config.tenant}/${config.signInPolicy}`;
const options = {
logger: logger,
redirectUri: config.redirectUri,
cacheLocation: config.cacheLocation,
postLogoutRedirectUri: config.postLogoutRedirectUri,
};
new Msal.UserAgentApplication(config.applicationId, authority, authCallback, options);
Upvotes: 3