Google登录Web应用程序无法使用Internet Explorer

c4h*_*n3o 23 iframe internet-explorer google-openid google-oauth google-signin

使用Google提供的快速入门示例,我已经能够登录Web应用程序以在Chrome和Firefox中使用.但是它在Internet Explorer(版本11)上失败.它会将用户登录到Google,但从data-onsuccess不会调用回调.通常没有任何错误通知.

我已阅读相关问题,并尝试了可信站点周围的建议.我还尝试调整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>
Run Code Online (Sandbox Code Playgroud)

我也尝试使用代码,使用侦听器来监听更改,如某些答案所示.我也没有成功.再次适用于Chrome/Firefox但不适用于IE.

每隔一段时间(并非所有时间),我都会在控制台中看到"SCRIPT5:访问被拒绝"错误消息.不完全确定为什么,但我注意到,当页面最终加载时,一些谷歌代码是在一个<iframe>,我想知道这是否是问题的一部分.

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

我现在完全失去了,我很想知道是否有人设法让这个与IE一起工作.IE是否需要一些配置才能使其正常工作?是否需要更改使其工作所需的代码?或者它在IE中基本上是不可行的?

我可以尝试的替代方案是服务器端流程但是我不确定这是否可以避免问题,理想情况下我想使用客户端方法.

任何反馈都表示赞赏.谢谢.

编辑:我已经托管了一个简单的页面来说明问题.此页面适用于Chrome,Firefox和Safari.但是当使用IE(v11)时失败.

小智 0

我使用登录并且它对我有用..

在此输入图像描述

这是我的 IE 版本:

在此输入图像描述