Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Sign In for Web Apps not working with Internet Explorer

Tags:

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.

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.

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> 

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.

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.

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.

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.

Any feedback is appreciated. Thank you.

Edit: 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.

like image 492
c4h5n3o Avatar asked Jul 18 '15 18:07

c4h5n3o


People also ask

Why Gmail is not opening in Internet Explorer?

I would suggest you to reset Internet Explorer and check if it helps. a) Drag the mouse to the bottom right corner and click on search. b) Click on 'Settings' and type 'Internet Options'. d) Click 'Reset' and click 'OK'.

How do I switch to a supported browser?

Select the Start button, and then type Default apps. In the search results, select Default apps. Under Web browser, select the browser currently listed, and then select Microsoft Edge or another browser.

Why do I get this page can't be displayed?

It's likely that your Windows Firewall blocks your connection to the website, so you see the error of page cannot be displayed message. Try turning off Windows Firewall in your computer to see if it works. Open Control Panel in your computer.


1 Answers

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.

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

  • Minimal Demo
  • Sample demo
  • Minimal Demo with insecure HTTP origin
like image 123
class Avatar answered Oct 23 '22 23:10

class