如何在我的网站中从 Google 启用此凭据选择器?

Vic*_*rro 5 google-chrome google-signin googlesigninapi

我想集成一个自动登录弹出窗口,如https://www.lequipe.fr 中显示的那样

它会在浏览器中检测您的会话并询问您是否要使用您的 Google 帐户加入。

我怎样才能在我的网站上实现这一点?(我已经有 Google 登录) - 正在使用 GAPI API?

谢谢

Ber*_*tel 10

这是Google One-tap 注册,可以使用他们的 API 进行集成,请按照本指南在您的网站中设置 Google One Tap。

在 Google 控制台中添加 Oauth2 ClientID 后。你只需要使用类似的东西:

<!DOCTYPE html>
<html>
<head>
    <script src="https://accounts.google.com/gsi/client" async defer></script>
</head>
<body>
    <div id="g_id_onload"
        data-client_id="XXXXXXXXXXXX-bk2lj5rs6l4c6g23nmtsfdh66qhfu921.apps.googleusercontent.com"
        data-login_uri="https://localhost:3000/login"
    >
    </div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

你会得到:

在此处输入图片说明