【问题标题】:From GoogleYolo (Google Smart Lock), what does "Invalid audience" mean?来自 GoogleYolo(Google Smart Lock),“无效观众”是什么意思?
【发布时间】:2018-08-26 18:28:18
【问题描述】:

错误/警告消息(由 https://www.gstatic.com//mss/boq-identity//js/k=boq-identity.IdentityYoloWebModuleset.en.5jYiE0Kzqd0.O/m=yolo_frame_library/rt=j/d=1/rs=AOaEmlHvGDn8UcjjSaG2zLiaoxdbMowW7g 的混淆代码写入控制台,Chrome 版本 65.0.3325.162)是“无效的受众。请使用 Google Cloud 控制台 (https://console.developers.google.com),并创建一个有效的 OAuth2网络客户端。”

我在关注https://developers.google.com/identity/one-tap/web/get-started -- 有人知道在任何地方是否存在单存档完整示例吗? (我看了。)

我的代码如下,我确实将https://localhost:8000 和一个个人网站设置为 https 作为相关客户端 ID 的允许来源,这是我正在测试的地方。

<html>
 <head>
    <script src="https://smartlock.google.com/client"></script>
 </head>
 <body>
   <script>
const clientID = "...";
const authUri = "https://accounts.google.com";

window.onGoogleYoloLoad = (googleyolo) =>
    {
    const retrievePromise = googleyolo.retrieve(
        {
        supportedAuthMethods: [ authUri ],
        supportedIdTokenProviders: [ { uri: authUri, clientId: clientID } ]
        });
    }
  </script>
 </body>
</html>

此外,我测试了类似的代码,除了googleyolo.hint 然后googleyolo.retrieve 和其他方式。两种方式,每次我刷新页面时,就好像我以前从未访问过一样——这就是我是否在 Chrome 中登录到谷歌。那么提示完成后,需要做什么来保存或存储该状态?

【问题讨论】:

    标签: google-api google-signin google-identity-toolkit google-identity google-smartlockpasswords


    【解决方案1】:

    我在这里找到了一些工作示例 -

    https://www.codeproject.com/Articles/579564/JavaScript-oAuth

    https://developers.google.com/identity/sign-in/web/sign-in

    我使用 CodeProject 链接中的示例设置了一个测试脚本,并且只是注释掉了我不需要的部分。

    <div class="loginDiv">
        <div id="googlelogin">Google</div>
    </div>
    <div style="clear:both;" id="userinfo"></div>
    

    var clientId = '.....';

    var scopes = 'https://www.googleapis.com/auth/plus.me';

    享受吧!

    【讨论】:

    猜你喜欢
    • 2019-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-06
    • 2014-02-14
    • 1970-01-01
    • 2013-01-09
    相关资源
    最近更新 更多