Google登录不适用于Internet Explorer的Web应用程序 [英] Google Sign In for Web Apps not working with Internet Explorer

查看:152
本文介绍了Google登录不适用于Internet Explorer的Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Using the quick start sample provided by Google I've been able to get Sign In for Web Apps to work in Chrome and Firefox. However it fails on Internet Explorer (version 11.) It will log the user into Google but the data-onsuccess call back is never called. And there are typically no notifications of any errors.

我读过相关问题并尝试了可信站点周围的建议。当IE接受第三方cookie时,我也尝试过调整,但这似乎都不起作用。

I've read a related question and have tried the suggestions around Trusted Sites. I've also experimented with adjusting when IE accepts 3rd party cookies but none of this seems to work.

我正在使用的测试页面的代码低于(减去客户端ID)

The code for the test page I'm using is below (minus the client-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>

我也尝试使用代码来使用监听器来监听变化,正如一些< a href =https://stackoverflow.com/questions/30895708/google-sign-in-not-returning-error-also-not-signing-in>答案。我也没有成功。再次适用于Chrome / Firefox但不适用于IE。

I've also tried this with code that uses listeners to listen for changes, as suggested by some answers. I've had no success with that approach either. Again works in Chrome/Firefox but not in IE.

每隔一段时间(并非所有时间)我都会看到SCRIPT5:访问被拒绝错误消息安慰。不完全确定原因,但我注意到,当页面最终加载时,某些Google代码位于< iframe> 中,我想知道这是否属于问题。

Every so often (not all the time) I do see a "SCRIPT5: Access is denied" error message in the Console. Not exactly sure why but I do notice that when the page is ultimately loaded some of the Google Code is in an <iframe> and I'm wondering if this is part of the problem.

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

I host the above test page on a local instance of Apache (running in Windows) and I'm wondering if there are cross domain issues perhaps with the code in the <iframe> coming from Google.

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

I'm at a complete loss at the minute and I'm eager to know if anyone has managed to get this to work with IE. Is there some configuration required to IE to allow this to work? Are there changes to the code needed to make it work? Or is it just essentially unworkable in IE?

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

An alternate that I can try is the server side flow however I'm not sure if this avoids the problem and ideally I'd like to use client side approach.

感谢所有反馈。谢谢。

编辑:我主持了简单页面说明了问题。此页面适用于Chrome,Firefox和Safari。但是当使用IE(v11)时失败。

I've hosted a simple page that illustrates the problem. This page works in Chrome, Firefox, and Safari. But fails when IE (v11) is used.

推荐答案

Google身份团队 11月修复此问题。如果您继续在在GitHub上托管的JavaScript演示上发现问题,请报告和问题

The Google Identity team fixed this in November. If you are continuing to see issues on the JavaScript demo hosted at GitHub, please report and issue.

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

You can check the following demos to see the sample work on Edge/IE11:

  • Minimal Demo
  • Sample demo
  • Minimal Demo with insecure HTTP origin

这篇关于Google登录不适用于Internet Explorer的Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆