I have a website with Google Sign-In. Recently, I received an email from Google, saying that I will be migrated to Federated CM (FedCM) by 4.2024. I do not understand what it is and what it means. The email links to this page for guidance, but I do not see how to implement it in my code. Specifically, my current code looks like this:
<script type='text/javascript' src='https://apis.google.com/js/platform.js?onload=onLoad' async defer></script>
<meta name='google-signin-client_id' content='$GLOBALS[google_signin_client_id].apps.googleusercontent.com'>
<style>
iframe#ssIFrame_google {display:none}
</style>
<script type='text/javascript'>
function onLoad() {
if (!gapi.auth2) {
gapi.load('auth2', function() {
gapi.auth2.init();
});
}
}
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
var redirectUrl = '?followup=$followup&id='+encodeURIComponent(profile.getId())+'&name='+encodeURIComponent(profile.getName())+'&email='+encodeURIComponent(profile.getEmail())+'&image='+encodeURIComponent(profile.getImageUrl());
window.location = redirectUrl;
}
</script>
and the first step in the migration guide says:
- Add a boolean flag to enable FedCM when initializing using:
HTML, set the data-use_fedcm_for_prompt attribute to true.
JavaScript, set use_fedcm_for_prompt to true in the IdConfiguration object.
In my code, I do not see where I need to set the data-use_fedcm_for_prompt flag to true (on which object exactly)? And I do not see any IdConfiguration project.
What do I need to do for a successful migration?
Replace the platform.js script with the FedCM client library
and for the FedCM prompt, I think this is how it goes, will skip the HTML and use the JavaScript to load FedCM in the gapi.auth2.init() function.
This is it i think, hope that helps