我正在尝试使用Google创建我的业务API的平台,并且我正在使用google一键登录以征得用户的同意,但是当我使用此代码时,当我单击时会弹出另一个身份验证屏幕一键登录,这是图像示例 one tap sign in
2nd screen after one tap sign in 我想删除第二个屏幕并获得gmb同意
<script>
window.onload = function () {
google.accounts.id.initialize({
client_id:
"8.apps.googleusercontent.com",
callback: handleCredentialResponse,
});
google.accounts.id.prompt((notification) => {
if (notification.isNotDisplayed() || notification.isSkippedMoment()) {
console.log("opted out");
}
});
function handleCredentialResponse(response) {
// window.location = "https://github.com/";
const config = {
response_type: "permission",
scope: "https://www.googleapis.com/auth/plus.business.manage",
client_id:
"8.apps.googleusercontent.com",
};
gapi.auth2.authorize(config, function (response) {
});
}
};
</script>
答案 0 :(得分:1)
第二个身份验证屏幕实际上是一个弹出窗口,对于防止点击劫持很有用。
在非Chrome(或Chrome 74或更低版本)浏览器上,需要弹出窗口,因为它们没有可靠的方式来防止点击劫持的攻击。 有关更多详细信息,请访问:https://developers.google.com/identity/one-tap/web/guides/features#dialog-to-prevent-unintended-clicks
在Chrome 75+上,除非One Tap UI包含其他内容,否则不需要弹出窗口。 有关更多详细信息,请访问:https://developers.google.com/identity/one-tap/web/guides/display-google-one-tap#do_not_cover_google_one_tap