Google oauth2 javascript client not working in IE 9

Although the following code works correctly using Chrome (it displays a pop-up window that asks the user for permission to access the map and places the data), IE 9 opens a pop-up window, but it is empty; when calling the handleAuthClick method. I tried to add setTimeouts, but with no effect. I ensured that popups are allowed and check the popup page urls that are identical in Chrome and IE. Has anyone encountered this issue? Or can someone offer a job?

var clientId = '############.apps.googleusercontent.com'; var apiKey = '#A#A#A#A##'; var scopes = 'https://www.googleapis.com/auth/plus.me'; function handleClientLoad() { gapi.client.setApiKey(apiKey); window.setTimeout(checkAuth, 1); } function checkAuth() { gapi.auth.authorize({ client_id: clientId, scope: scopes, immediate: true }, handleAuthResult); } function handleAuthResult(authResult) { if (authResult && !authResult.error) { makeApiCall(); } else { } } function handleAuthClick(event) { try { window.setTimeout(function () { gapi.auth.authorize({ client_id: clientId, scope: scopes, immediate: false }, handleAuthResult); }, 10); } catch (e) { alert(e.message); } } function makeApiCall() { gapi.client.load('plus', 'v1', function () { var request = gapi.client.plus.people.get({ 'userId': 'me' }); request.execute(function (resp) { $(".google-signin").find("img").attr('src', resp.image.url).css('height', '32').css('width', '32'); $("#login-msg").text('Welcome: ' + resp.displayName); $("img.vote").css('visibility', 'visible'); }); }); } 
+7
source share
3 answers

Ultimately, the solution to this problem was to increase the duration of setTimeout to 1000 from 10. The Google authorization pop-up window was displayed with the correct login information and not a blank screen.

+1
source

It is possible that firewalls between the client web application and Google are blocked by zone security.

Make sure that both google.com and the webpage the script is running on fall into the same security zone (usually an Internet zone). If you are not sure, see serverfault # 612903 https://serverfault.com/questions/612903/ie11-how-to-check-into-which-zone-a-url-falls

Also make sure that the zone in which the web application and Google is classified is configured to run the script and provides access to third-party cookies for google.com, as this is used to verify authorization.

+1
source

Please note that the map / channel scope you use is for legacy Google Maps data APIs, which is not the same as the Places API

As for your actual question, I will come back to replace the Places API Plus API, as that is what you are using here.

0
source

All Articles