Google one tap sign up always returns noCredentialsAvailable

久未见 提交于 2019-12-06 01:50:25

问题


I have set up a bare bones test for the new google one tap sign in / sign up.

<!DOCTYPE html>
<html lang="en">

<head></head>

<body>
  <script src="https://smartlock.google.com/client"></script>
  <script>
    window.onGoogleYoloLoad = (googleyolo) => {
      googleyolo.hint({
        supportedAuthMethods: [
          "https://accounts.google.com"
        ],
        supportedIdTokenProviders: [{
          uri: "https://accounts.google.com",
          clientId: "xxxxx-xxxxx.googleusercontent.com"
        }],
        context: "signUp"
      }).then((credential) => {
        console.log(credential);
      }, (error) => {
        console.log(error.type);
      });
    };
  </script>
</body>

I expected the above to either spit out the credential object to the console, or to prompt me to choose a google account to log in with. Instead a "noCredentialsAvailable" error type is thrown. This also happens when I use the googleyolo.retrieve promise.

I currently:

  • have a google account signed in and other "google sign in" oauth flows work
  • am loading the above at localhost:3000 (which is also listed as an authorised origin on my google api credentials page)

What am I missing?


回答1:


We just published some troubleshooting guidance: https://developers.google.com/identity/one-tap/web/troubleshooting

The most important things to check are the following:

  • ensure that you have an active Google Account and that the Smart Lock feature is enabled. We are working on removing these requirements asap, but for now, try with a regular gmail account with default settings

  • make sure that you supply a Google client ID in any requests and that the domain you are running the code is an authorized origin, including the port. See documentation for details

  • check that you are using a supported user-agent. Importantly, the iOS emulation modes in Chrome Dev Tools are out-of-date (fix pending)

If you still cannot get it working, or have any feedback at all, we'd love to hear from you: reach out to sso@google.com



来源:https://stackoverflow.com/questions/46998824/google-one-tap-sign-up-always-returns-nocredentialsavailable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!