谷歌Auth在2年后停止工作

时间:2015-07-31 15:25:35

标签: javascript google-api google-calendar-api

我有以下代码段:

// Google functions
var clientId = 'clientid';
var apiKey = 'apikey';
var scopes = 'https://www.googleapis.com/auth/calendar';

function handleClientLoad() {
    // Step 2: Reference the API key
    gapi.client.setApiKey(apiKey);
    gapi.client.load('calendar', 'v3', function () {
        window.setTimeout(checkAuth, 1);
    });
}

function checkAuth() {
    gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: true}, handleAuthResult);
}

function handleAuthResult(authResult) {
    console.error(authResult.error);
    if (authResult && !authResult.error) {
        if (!$('#authWait').is(':visible')) {
            $('#start').on("click", function () {
                $('#main').hide();
                $('#wizard').removeClass("hidden");
            });
        } else {
            $('#authWait').addClass("hidden");
            $('#wizard').removeClass("hidden");
        }
        fillCalendarList();
        ga('send', 'event', 'weergaveResultaat', 'action');
    } else {
        $('#start').on("click", function () {
            $('#main').hide();
            $('#authWait').removeClass("hidden");
            handleAuthClick();
        })
    }
}

我已经取代了clientid和apikey。上面的确切片段已在完全相同的配置下工作了2年。截至昨天,我正在handleAuthResult之后立即“立即失败”。

我找不到谷歌自昨天以来所做的任何改变细节。我已经尝试立即切换到false,但这并没有解决任何问题。

在立即失败后我得到'未捕获的TypeError:无法设置属性'apiVersion'未定义'。

任何人都知道造成这种情况的原因是什么?

0 个答案:

没有答案