-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gapi.client.init() promise fails silently if clientId/scope are provided #575
Comments
I faced the same issue and i followed the below alternative solution as a workaround. ` function initGapi() {
}` |
I also encounter this problem. If I set the Chrome F12 to 'offline', I can only find the below error in the console but neither onfulfilled() nor onrejected() is called.
|
@jameshfisher Here is the same. |
FYI: my eventual approach was to abandon gapi and use traditional server side SSO. I found gapi to be too full of bugs and complexities and weird behavior. |
This Bug seems to be still present |
facing the same issue |
Wrap it with a try catch. the onError callback only gets invoked when there's an error during invokation and not when there's an error with a pre-condition. |
Steps to reproduce
Copy-paste this into
index.html
and open in a web app:Expected behavior
Logs are
Actual behavior
Logs are
The
client inited
log line never appears. Crucially, neither does anyerror initing client
log line. So the returned Promise is violating its promise to either call thethen
callback or thecatch
callback.Cause
This behavior goes away if
clientId: CLIENT_ID, scope: SCOPES
is removed from thegapi.client.init
call. When those keys are removed, we get the full expected log lines.The docs for
gapi.client.init
say that:So presumably,
gapi.client.init
notices that those keys are present, so tries to "load the gapi.auth2 module to perform OAuth". In my example, the gapi.auth2 module is already loaded. Under these conditions,gapi.client.init
somehow forgets its duty to fulfil the returned promise.The text was updated successfully, but these errors were encountered: