Hi Patrice Côté ,
I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.
Issue:
You wanted to add a reCaptcha on your signin page using custom policies in Azure AD B2C. You were using the sample A B2C IEF Custom Policy which integrates with Google Captcha
You ran into two main issues:
- When adding the custom field "g-recaptcha-response-toms", it would not render.
- After you were able to resolve the first issue and get the information in the form, the "Forgot password" link would not display.
Solution:
- Updating the the page contract from "unifiedssp:2.1.5" to "selfasserted:2.1.9" page layout version resolved the issue of not being able to gather the information on the form.
- To add the "Forgot password" link, you had to create it on page load with JavaScript (see similar example with Terms of Use link):
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const login_hint = urlParams.get("login_hint");
const ui_locales = urlParams.get("ui_locales");
const state = urlParams.get("state");
const redirect_uri = urlParams.get("redirect_uri");
document.getElementById("login_hint").innerHTML = login_hint;
const forgotPassurl = ""+redirect_uri+"#error=access_denied&error_description=AADB2C90118%0d%0alogin_hint="+login_hint+"%0d%0a&state="+state+"&lang="+ui_locales+"";
if(ui_locales == "fr") {
document.getElementById('recaptchaScript').src = document.getElementById('recaptchaScript').src+"?hl=fr";
document.getElementById("forgotPassword").innerHTML = "Mot de passe oublié ?";
}
else {
document.getElementById('recaptchaScript').src = document.getElementById('recaptchaScript').src+"?hl=en";
document.getElementById("forgotPassword").innerHTML = "Forgot your password ?";
}
document.getElementById("forgotPassword").href = forgotPassurl;
If you have any other questions or run into more issues with the sample, please let me know.
Thank you again for your time and patience throughout this issue.
-
Please remember to "Accept the answer" if the answer accurately represents the issue and resolution, so that others in the community facing similar issues can easily find the solution.