Identity Toolkit无法识别的配置参数

时间:2015-11-19 09:44:26

标签: google-identity-toolkit

运行gitkit小部件时出现以下错误:

[  0.004s] [identitytoolkit] Invalid config: "callbackUrl"rj @ gitkit.js:236pj.addLogRecord @ gitkit.js:236Li.log @ gitkit.js:219Q @ gitkit.js:236zl @ gitkit.js:273(anonymous function) @ gitkit.js:306(anonymous function) @ gitkit-widget.html?mode=select:29

我的代码如下:

var config = {
            signInSuccessUrl: "/",
            apiKey: "AIzaSyAt3gELMqBCdn9U8FLSXbtCJbizHSX3kng",
            siteName: "Google Apps Training",
            signInOptions: ["google","facebook", "microsoft"],
            //idps: ["google", "facebook", "microsoft"],
            /*callbacks: {
                signInSuccess: function(tokenString, accountInfo, signInSuccessUrl) {

                    console.log("callback");
                    console.log(tokenString);
                    console.log(accountInfo);
                    console.log(signInSuccessUrl);

                    return true;
                }
            },*/
            callbackUrl: "http://localhost:8080/signin"
        };

        // The HTTP POST body should be escaped by the server to prevent XSS
        window.google.identitytoolkit.start(
                '#gitkitWidgetDiv', // accepts any CSS selector
                config);

以下是https://developers.google.com/identity/toolkit/web/setup-frontend

提供的gitkit文档示例
var config = {
          apiKey: 'AIza...',
          signInSuccessUrl: '/',
          signInOptions: ["google", "password"],
          oobActionUrl: '/',
          siteName: 'this site',

          // Optional - function called after sign in completes and before
          // redirecting to signInSuccessUrl. Return false to disable
          // redirect.
          // callbacks: {
          //  signInSuccess: function(tokenString, accountInfo,
          //    opt_signInSuccessUrl) {
          //      return true;
          //    }
          // },

          // Optional - key for query parameter that overrides
          // signInSuccessUrl value (default: 'signInSuccessUrl')
          // queryParameterForSignInSuccessUrl: 'url'

          // Optional - URL of site ToS (linked and req. consent for signup)
          // tosUrl: 'http://example.com/terms_of_service',

          // Optional - URL of callback page (default: current url)
          // callbackUrl: 'http://example.com/callback',

          // Optional - Cookie name (default: gtoken)
          //            NOTE: Also needs to be added to config of the ‘page with
          //                  sign in button’. See above
          // cookieName: ‘example_cookie’,

           // Optional - UI configuration for accountchooser.com
           /*acUiConfig: {
               title: 'Sign in to example.com',
               favicon: 'http://example.com/favicon.ico',
               branding: 'http://example.com/account_choooser_branding'
           },
           */

           // Optional - Function to send ajax POST requests to your Recover URL
           //            Intended for CSRF protection, see Advanced Topics
           //      url - URL to send the POST request to
           //     data - Raw data to include as the body of the request
           //completed - Function to call with the object that you parse from
           //            the JSON response text. {} if no response
           /*ajaxSender: function(url, data, completed) {
                         },
           */
      };
      // The HTTP POST body should be escaped by the server to prevent XSS
      window.google.identitytoolkit.start(
          '#gitkitWidgetDiv', // accepts any CSS selector
          config,
          'JAVASCRIPT_ESCAPED_POST_BODY');

因此,如果最新的示例代码显示" callbackUrl"作为可用的可选参数,为什么gitkit js不能将其识别为有效?

是否有可以检查所有可用参数的地方?

问候。

1 个答案:

答案 0 :(得分:0)

callbackUrl不再是有效字段。文档不正确,将立即更新。对此我们深表歉意,我们感谢您将此提交给我们。小部件当前网址将自动用作IDP回调网址,因此请务必在您的IDP(谷歌,脸书等)oauth客户端设置(回调网址)中添加小部件网址。