23

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.

gerry3
  • 21,420
  • 9
  • 66
  • 74
c4h5n3o
  • 231
  • 2
  • 5
  • 1
    Bump: I have the same problem with the same error. I see "SCRIPT5: Access is denied. File: iframe, Line: 1, Column: 1" The iframe is: ` ` – razor Aug 11 '15 at 15:55
  • 1
    We need Google to fix this. Anyone know a way to open an issue with them? I updated the tags on this question and another (https://stackoverflow.com/questions/31170572/basic-google-sign-in-for-websites-code-not-working-in-internet-explorer-11) to both of the ones they recommend (https://groups.google.com/forum/#!topic/google-federated-login-api/TL9Pxn_s7yw) – gerry3 Sep 14 '15 at 20:03

5 Answers5

3

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:

class
  • 8,621
  • 29
  • 30
  • Can you add the HTTP origin to the 'Minimal demo'? It works with HTTPS in Internet Explorer 11, but I can´t get it to work with HTTP protocol (even it works fine in other browsers) – Troglo Apr 28 '16 at 15:30
  • Thanks, as expected in your domain works fine, but when I copy your exact same code to my domain, only in Internet Explorer 11 continue asking to close the Google login window and doesn´t work. I don´t know what could be the problem with IE11, because the Client ID in the Google Developers Console looks right and it works fine in the rest of browsers. The only difference is when it works, call this URL: https://accounts.google.com/o/oauth2/iframerpc?action=issueToken&... and in my server in IE11 doesn't call any – Troglo May 10 '16 at 08:58
  • Looks like the problem only happens in LAN with IE11 and Edge (external access works fine in all browsers). – Troglo May 17 '16 at 11:19
  • @Troglo My code should not work if you copy/paste it without updating the client ID to one that is correct for your domain. – class Aug 04 '16 at 22:15
  • 1
    of course, we used our client ID, and it worked fine in others browsers, but not yet in IE11 – Troglo Aug 17 '16 at 16:32
0

I used sign in and it worked for me ..

enter image description here

Here is my IE version :

enter image description here

  • I too get the popup. But after Accepting, do you actually get Signed In (does the button change, and is your onsuccess callback called? – razor Aug 18 '15 at 22:24
  • yes I did, as a matter of fact in my connected applications list it was being listed .. – Aakash Shah Aug 19 '15 at 03:59
  • and you are using same code as google's developer guide then you must understand that you left some lines of codes as you need to pass on the ID token to your website backend and thats what you haven't included in the code .. from there the response is collected and thats what not you have included – Aakash Shah Aug 19 '15 at 04:12
  • It's not my code, but in my environment I do that. But with onsuccess never being called, I have no jwt to pass on. – razor Aug 19 '15 at 14:25
  • Also, I noticed that my IE11 version is 11.0.9600.17959 – razor Aug 19 '15 at 14:36
0

Try to load your scripts from other place than google. According to this Question (Preventing "SCRIPT5: Access is denied" error in IE) that "SCRIPT5: Access is denied. " error is a way Ms has to 'protect' the user against XSS.

So, try to download https://apis.google.com/js/platform.js and use it form your local server instead.

Community
  • 1
  • 1
Juan
  • 2,156
  • 18
  • 26
  • Good idea, but no effect. Since platform.js adds ` – razor Aug 18 '15 at 22:23
0

Has there been any new ideas on this issue? I'm also seeing the same problem when trying to use the g-signin2 methods. I'm using the old s-gignin without issue right now across all browsers.

Oddly enough, this works for me on an IE10 browser, but not on IE11 or Edge

  • This was working for me with g-signin as well. When I switched to g-signin2 was when the problems started. – razor Aug 19 '15 at 14:26
0

While running in localhost, if you add Form Id to your form in Login page, it wont process after login through Google Login button. Even the Login status wont get changed to "Signed" on Google Login button. But this can be resolved by running the page on Public Server, since IE has feature to restrict scripts while running locally.

Usmin S
  • 31
  • 2