You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If people try to sign in before the Google API file loads, it'll show the error in the title. I can consistently repro this error by throttling my network speed.
I tried to fix this by adding await this.gapiLoaded; to the beginning of signIn(). However, this.gapiLoaded is undefined, even though initialize() ran already.
In this screenshot, gapiResolve is defined, which means initialize() ran already. I don't know why this.gapiLoaded and this.options are undefined. Seems like something weird with Capacitor's plugin proxy?
The GoogleAuth object in initialize() vs in signIn():
The text was updated successfully, but these errors were encountered:
In my code I've created a method where I try and check if the window.gapiResolve property is defined or not.
If defined then it's probably loaded correctly and vice versa...
async waitForGapiResolve() {
return new Promise((resolve, reject) => {
const intervalId = setInterval(() => {
if (window['gapiResolve']) {
clearInterval(intervalId);
resolve(true); // gapiResolve is available
} else {
console.log('waiting for 100ms more...');
}
}, 100); // Check every 100ms
// Set a maximum timeout
setTimeout(() => {
clearInterval(intervalId);
reject(new Error('Gapi resolve timed out'));
}, 3000); // Example 3-second timeout
});
}
Then the code will run it before running the signIn method
If people try to sign in before the Google API file loads, it'll show the error in the title. I can consistently repro this error by throttling my network speed.
I tried to fix this by adding
await this.gapiLoaded;
to the beginning ofsignIn()
. However,this.gapiLoaded
is undefined, even thoughinitialize()
ran already.In this screenshot,
gapiResolve
is defined, which meansinitialize()
ran already. I don't know whythis.gapiLoaded
andthis.options
are undefined. Seems like something weird with Capacitor's plugin proxy?The
GoogleAuth
object ininitialize()
vs insignIn()
:The text was updated successfully, but these errors were encountered: