【问题标题】:Google identity toolkit returns INVALID_RESPONSEGoogle 身份工具包返回 INVALID_RESPONSE
【发布时间】:2015-06-26 07:40:16
【问题描述】:

我想将谷歌身份工具包集成到一个角度应用程序中,但在流程之后不是,谷歌身份工具包小部件对谷歌 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: '/'' });

【问题讨论】:

  • 你能解决这个问题吗?我有一个可以发布的解决方案。

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


【解决方案1】:

带有小部件 URL 的页面的末尾需要有 ?mode=select,否则您会收到 INVALID_RESPONSE 错误。

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

【讨论】:

    猜你喜欢
    • 2015-12-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多