I recently received an email from Google saying that:

We are writing to let you know that Google will discontinue support for sign-ins to Google accounts from embedded browser frameworks, starting January 4, 2021. We are following up with you about a recent blog post outlining our effort to block less secure browsers and applications.

I read the blog post, but could not understand how to relate it to the code in my web server, and what exactly I should make to prepare for the change. Here is the relevant PHP code (that mostly generates HTML and Javascript):

    <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'>
    <script type='text/javascript'>
        function onLoad() {
                if (!gapi.auth2) {
                    gapi.load('auth2', function() {
        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;
        function onSignOut() {
                var auth2 = gapi.auth2.getAuthInstance();
                console.log('User signing out.');
                auth2.signOut().then(function () {
                        console.log('User signed out.');
                        var redirectUrl = '?followup=$followup';
                        window.location = redirectUrl;


    <div class='g-signin2' data-onsuccess='onSignIn'></div>


    <a href='#' onclick='onSignOut()'>logout</a>

What exactly should I change in this code to ensure that my website works after 4/1/2021?

  • Your code is installed on your website and your visitors use standard web browsers, right? You don't have an app or device with an embedded browser that logs into Google? Nov 18, 2020 at 10:25
  • My code is installed on my web-server. I do not know what my visitors use - I guess most of them use standard web browsers. I do not know what an embedded browser is Nov 18, 2020 at 14:25


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.