Tuesday, 25 July 2023

Error trying to add JavaScript to Azure B2C Local Signup Page

I have the following arbitrary JavaScript snippet on an HTML page stored in Azure Storage (using a screenshot to try to demonstrate, as far as I can see, that the syntax is correct): enter image description here

The page loads, it is styled correctly and everything else you would expect, proving that it is configured correctly, CORS is set etc. But the JavaScript does not run. Instead I get this error:

unified:5 Uncaught SyntaxError: Unexpected token '&'
at br (unified?local=signup&[omitted_for_brevity])
at at (unified?local=signup&[omitted_for_brevity])
at i.fn.init.append (unified?local=signup&[omitted_for_brevity])
at unified?local=signup&[omitted_for_brevity]

This is presumably being caused by this: enter image description here

Extra script caused by some kind of parse or encoding error on the original script tag.

If I load the file from storage container directly, it loads and the JavaScript fires with no problems. This tells me the HTML file is fine, so either:

  • how I am loading it does not play nicely with B2C
  • I have not configured something on the B2C side to allow JavaScript
  • Something else

I have configured everything that I can see on the User Flow:

  • Enable JavaScript enforcing page layout is set to On
  • Path to custom HTML is set
  • CORS is configured for the custom HTML

Has anyone seen this problem before or can see what I may have done wrong in how this is configured?

Edit: Am roughly following this guide: https://learn.microsoft.com/en-us/azure/active-directory-b2c/javascript-and-page-layout?pivots=b2c-user-flow



from Error trying to add JavaScript to Azure B2C Local Signup Page

No comments:

Post a Comment