Google身份工具包会返回INVALID_RESPONSE

时间:2015-04-19 17:29:19

标签: angularjs google-identity-toolkit google-identity

我想在一个有角度的应用程序内集成google身份识别工具包,但是在流量不适用之后,谷歌身份工具包小部件调用google api会返回错误。这是重定向后的路线,它是一个空页http://localhost:8000/?mode=select/#/GoogleIdentity

POST / verifyAssertion

{
   "error": {
       "errors": [
            {
            "domain": "global",
            "reason": "invalid",
            "message": "INVALID_RESPONSE"
            }
        ],
        code": 400,
        "message": "INVALID_RESPONSE"
    }
}

这是我的代码:

.controller('GoogleIdentityCtrl', ['$scope', '$rootScope', function ($scope, $rootScope, localStorageService) {
    var config = {
        apiKey: 'dkfjdslfjeoi-not-real-api-key',
        signInSuccessUrl: '/',
        idps: ['google'],
        oobActionUrl: 'http://localhost:8000/#/GoogleIdentity',
        siteName: 'this site',
    };
    window.google.identitytoolkit.start('#gitkitWidgetDiv', config, 'JAVASCRIPT_ESCAPED_POST_BODY');
}]);

window.google.identitytoolkit.signInButton('#navbar', { widgetUrl: 'http://localhost:8000/#/GoogleIdentity', signOutUrl: '/'' });

1 个答案:

答案 0 :(得分:1)

包含小部件URL的页面在其末尾需要?mode=select,否则会出现INVALID_RESPONSE错误。

我认为教程给出的流程是你有一个页面上有登录按钮,然后重定向到包含小部件模板的页面(让我们称之为callback.html)。 callback.html需要是开发人员控制台中的小部件网址,您需要将callback.html设为允许的引荐网址。

相关问题