gpt4 book ai didi

internet-explorer - Google Apps for Web Apps登录无法与Internet Explorer一起使用

转载 作者:行者123 更新时间:2023-12-03 11:30:06 26 4
gpt4 key购买 nike

使用Google提供的quick start sample,我可以使Web应用程序登录到Chrome和Firefox。但是,它在Internet Explorer(版本11)上失败。它将使用户登录到Google,但是从不调用data-onsuccess回调。而且通常没有任何错误的通知。

我已阅读related question,并尝试过有关“受信任的站点”的建议。我也尝试过调整IE何时接受第三方Cookie,但似乎没有任何作用。

我正在使用的测试页代码如下(减去客户端ID)

<html>
<head>
<meta charset="ISO-8859-1">
<title>Google Sign In</title>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="CLIENT_ID_FROM_GOOGLE_HERE">
<script>

function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
console.log('ID: ' + profile.getId());
console.log('Name: ' + profile.getName());
console.log('Image URL: ' + profile.getImageUrl());
console.log('Email: ' + profile.getEmail());
}

function signOut() {
console.log(document);

var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
console.log('User signed out.');
});
}
</script>
</head>

<body>
<h1>Login</h1>
<p>
This is a simple page to test Google Sign In IE
</p>

<div class="g-signin2" data-onsuccess="onSignIn">
Sign In Button Rendered Here
</div>

<div>
<a href="#" onclick="signOut();">Sign out</a>
</div>
</body>
</html>

正如一些 answers所建议的,我还尝试了使用侦听器监听更改的代码。这种方法我也没有成功。再次可以在Chrome / Firefox中使用,但不能在IE中使用。

我经常(并非一直)都在控制台中看到“SCRIPT5:访问被拒绝”错误消息。不确定原因,但我确实注意到,最终加载页面时,某些Google代码在 <iframe>中,我想知道这是否是问题的一部分。

我将上面的测试页托管在Apache的本地实例上(在Windows中运行),我想知道是否存在跨域问题,也许来自 <iframe>的代码来自Google。

我一时完全不知所措,我很想知道是否有人设法将其与IE配合使用。 IE是否需要一些配置才能使其正常工作?使它工作所需的代码是否有所更改?还是在IE中根本不可行?

我可以尝试的替代方法是 server side flow,但是我不确定这是否可以避免问题,并且理想情况下,我想使用客户端方法。

任何反馈表示赞赏。谢谢。

编辑:我托管了 simple page来说明问题。此页面可在Chrome,Firefox和Safari中使用。但是在使用IE(v11)时失败。

最佳答案

Google身份团队fixed this in November。如果您继续在JavaScript demo hosted at GitHub上看到问题,请report and issue

您可以查看以下演示以查看Edge / IE11上的示例工作:

  • Minimal Demo
  • Sample demo
  • Minimal Demo with insecure HTTP origin
  • 关于internet-explorer - Google Apps for Web Apps登录无法与Internet Explorer一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31494204/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com