Authorization popup window

1,493 views
Skip to first unread message

Roman Denysiuk

unread,
Dec 14, 2011, 6:07:47 AM12/14/11
to Google API JavaScript Client
Is there any way to prevent blocking authorization window as popup
window?
When I use window.open command from my local javaScript authorization
popup window is not blocking by browser, but if I use your
gapi.auth.authorize command from my local javaScript authorization
popup window is blocking by browser.

Brendan

unread,
Dec 14, 2011, 12:32:20 PM12/14/11
to Google API JavaScript Client
gapi.auth.authorize must first setup a relay iframe to make the
authorization call. When the iframe is ready it notifies the container
which then starts the auth flow. This is what triggers the popup
blocker. To prevent this, call gapi.auth.init() when the JS Client
library loads to setup the relay frame. Subsequent authorize calls
(triggered by user action) will not trigger the popup blocker.

Roman Denysiuk

unread,
Dec 14, 2011, 6:49:09 PM12/14/11
to Google API JavaScript Client
Thank you very much, it helped me

Roman Denysiuk

unread,
Dec 14, 2011, 7:04:07 PM12/14/11
to Google API JavaScript Client
Sorry, I have hurried with results. Now I have an error:

GP_Tf[a] is not a function
[Прерывать на этой ошибке] GP_Yf,"?
parent=",encodeURIComponent(GP....length;a<b;a++)GP_Tf[a]();GP_Tf=GP_}

Brendan

unread,
Dec 14, 2011, 7:33:11 PM12/14/11
to Google API JavaScript Client
I believe you're running into a known bug, for which a fix is coming.
The callback for gapi.auth.init is NOT optional. You must provide at
least an empty function:

gapi.auth.init(function() {});

Roman Denysiuk

unread,
Dec 14, 2011, 7:39:50 PM12/14/11
to Google API JavaScript Client
Yes, now it works fine. Thank you again!
Reply all
Reply to author
Forward
0 new messages