Google 加上 API 关闭,这将如何影响 Google 网站的 auth2 登录?

Google plus API shutdown, How it will affect Google auth2 login for web sites?

我对来自 Google 的关闭通知邮件感到困惑,最近提到的一封邮件被称为

projects directly requesting the “plus.me” scope are affected. This scope may have been listed in some emails, even if not directly requested by your project. We apologize for any confusion caused.

我正在使用以下 JS 代码登录,我可以知道它是否会因 Google 加上 api 关闭而受到影响?

<script async defer src="https://apis.google.com/js/api.js" onload="this.onload=function(){};HandleGoogleApiLibrary()" onreadystatechange="if (this.readyState === 'complete') this.onload()"></script>

<script type="text/javascript">
//google login starts
function HandleGoogleApiLibrary() {
    // Load "client" & "auth2" libraries
    gapi.load('client:auth2', {
        callback: function() {
            // Initialize client library
            // clientId & scope is provided => automatically initializes auth2 library
            gapi.client.init({
                apiKey: 'API KEY HERE',
                clientId: 'XXXXXXXXXXXXXXXXX.apps.googleusercontent.com',
                scope: 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email'                        
            }).then(
                // On success
                function(success) {
                    // After library is successfully loaded then enable the login button
                    //CODE AFTER SUCCESS
                }, 
                // On error
                function(error) {                    
                    alert('Error : Failed to Load Library');
                }
            );
        },
        onerror: function() {
            // Failed to load libraries
        }
    });
}

// Click on login button
$("#login-button").on('click', function() {
    // API call for Google login
    gapi.auth2.getAuthInstance().signIn().then(
        // On success
        function(success) {
            // API call to get user information
            gapi.client.request({ path: 'https://www.googleapis.com/plus/v1/people/me' }).then(
                // On success
                function(success) {
                    console.log(success);
                    var user_info = JSON.parse(success.body);                       
                    //VALIDATION                 
                },
                // On error
                function(error) {                                               
                    alert('Error : Failed to login');
                }
            );
        },
        // On error
        function(error) {
            $("#login-button").removeAttr('disabled');
            alert('Error : Login Failed');
        }
    );
});

有好消息也有坏消息。

好消息是您没有使用任何加 范围

坏消息是您正在使用 plus API,它也将被关闭,并且在之前应该发送给您的电子邮件中提到过。

具体来说,这段代码:

gapi.client.request({ path: 'https://www.googleapis.com/plus/v1/people/me' }).then(

调用 "plus.people.me" API。

幸运的是,您应该能够切换到不同的 API,例如 "userinfo" API,方法是将端点更改为

https://www.googleapis.com/oauth2/v2/userinfo

您可能还希望研究更现代的 People API,它的工作原理非常相似,但稍微复杂一些,但可以提供其他配置文件字段。