Popup blocking the gdrive authorization in chrome

authentication, google-drive-api, javascript

Solution

Try this:

Include an onload event in your call to client.js

`<script type="text/javascript" src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script>`

Call gapi.auth.init from the onload function:

`function handleClientLoad() { window.setTimeout(gapi.auth.init,1); }`

In your authorize configuration set immediate: false.

Check that 1. is below 2. in the flow of the page.

Problem

So, the problem is that popup blocking the window open even if it is done by a user action, click for example.. ``` gapi.auth.authorize({ client_id: this.client_id, scope: this.scopes, access_type: 'online', immediate: immediate }, function(authResult) { console.log(authResult) }); ``` If i simply open the window on user click as here: ``` $('.some').click(funciton(){ window.open(someurl) }) ``` it works fine, but if i did it throw the gdrive api(gapi.auth.authorize), this blocking anyway. A must, I can not force users to off popap blocking. I hope that anybody now how solved it :), thanks

Original source