代码之家  ›  专栏  ›  技术社区  ›  Dimitrij Agal

Google Smartlock/Googleyolo未返回保存的密码

  •  0
  • Dimitrij Agal  · 技术社区  · 8 年前

    根据文件( https://developers.google.com/identity/one-tap/web/retrieve-credentials ),我们可以获得保存的密码,就像在Chrome上使用凭据管理API一样。

    我目前已经在浏览器中登录到谷歌。 我尝试使用googleyolo api,使用 .retrieve() 记录的功能:

    const retrievePromise = googleyolo.retrieve({
      supportedAuthMethods: [
        "https://accounts.google.com",
        "googleyolo://id-and-password"
      ],
      supportedIdTokenProviders: [
        {
          uri: "https://accounts.google.com",
          clientId: "*********-**********.apps.googleusercontent.com"
        }
      ]
    }).then(res => console.log(res));
    

    它只返回 idToken ,没有返回密码。

    但奇怪的是,当我尝试在Chrome上使用凭据管理API时,我保存的凭据突然出现。

    问题是, 1、出了什么问题? 2、googleyolo是从哪里获得其证书列表的?因为我在 https://passwords.google.com ,并且我的凭据存在 3、我应该怎么做/排除故障以获取密码凭据?

    2 回复  |  直到 8 年前
        1
  •  1
  •   Steven    8 年前

    很抱歉造成混淆,密码仅在支持凭据管理API(库用于检索密码)的浏览器中可用。将更新文件以澄清这一点。

        2
  •  0
  •   Wen W    8 年前

    不知道你从哪里得到的“g”oogleyolo://id-and-password“在supportedAuthMethods参数中。在您的链接中,它明确表示只支持Google。

    googleyolo从您当前的浏览器中获取用户列表。如果您有多个用户登录到Google帐户,您将获得更多用户。

    当我实现Google登录时,我只需使用idtoken来确认用户的身份。调用googleyolo时没有返回密码。

    确认用户身份后,可以使用提供的方法登录。

    useGoogleIdTokenForAuth(credential.idToken);