Azure AD B2C - Custom template - rely on injected element IDs in JS

VasiT 31 Reputation points
2022-02-22T15:50:10.697+00:00

I'm having a signup page in AD B2C with custom template and standard User flows.
I needed to add some extra UI logic, to hide and show some buttons in different stages of form completion.
For example I would initially hide the main "continue" button, and only show it after code verification has succeeded.
I managed to do all of this with custom JS and JQuery and it works well.

But to achieve this, I rely on the visibility state of some Azure injected buttons, which I identify by id.
For example I look with JQuerry for buttons with IDs like "emailVerificationControl_but_verify_code" or "continue" and operate on them.

So the question is how safe is this approach on the long run. Can we rely on the fact that the IDs of those buttons will not change in time (breaking our logic)?

Thank you,
Vasile

Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,884 questions
0 comments No comments
{count} votes

Accepted answer
  1. AmanpreetSingh-MSFT 56,611 Reputation points
    2022-02-22T17:01:07.267+00:00

    Hi @VasiT • Thank you for reaching out.

    In the string ID emailVerificationControl_but_verify_code, but_verify_code is a fixed string. A list of all the strings used in B2C is provided in the Localization string IDs document. At the beginning of this string ID, attribute/claim ID emailVerificationControl is added as a prefix. In the case of user flows, this value is predefined and is not configurable.

    In case of Custom Policy, this prefix is based on the email Claim ID that you can change in the claims schema section of your custom policy files. That means, if the email claim is changed to email1, the string ID will change to email1_but_verify_code

    176868-image.png

    The string for the continue button cannot be changed in either user flows or custom policy.

    -----------------------------------------------------------------------------------------------------------

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.