Calls to onAuthStateChanged and onIdTokenChanged send off a flurry of requests to securetoken.googleapis.com/v1/token until it responds with QUOTA_EXCEEDED. This only happens when the user is authenticated.
This error does not occur on Linux or macOS. I was not able to replicate it in a windows VM on Linux. It's only on windows in both firefox and chrome. However, I've only had success replicating with 2 windows machines and failed to replicate on another windows laptop.
https://stackblitz.com/edit/firebase-issue-sandbox-vzdnt7
This is the strangest bug that I've run across and it took quite a bit to isolate the exact sequence of events that was causing it.
My initial thoughts are that calls to the firestore document snapshot are causing the onAuthStateChanged observer to trigger.
edit: I just did some more digging and this bug does not happen in 7.9.3 but does in 7.10.0
Interesting.. I'm not sure but I suspect this is more related to the Firestore SDK than Auth directly. I'm rerouting this to Firestore.
Thanks for reporting the issue. I will try to reproduce it and will post an update when I have one.
same here
I'm really sorry, but I had no luck trying to reproduce this so far. I'm using a Windows 10 laptop and Chrome. The only significant change I made to the repro case is to change the project configuration. Can you please clarify a few things? (I have added numbers to the reproduction steps in your original message to make it easier to refer to them, I hope you don't mind)
Finally, could you please enable debug logging, reproduce the issue and share the resulting logs? (please omit any sensitive information)
This is likely caused by https://github.com/firebase/firebase-js-sdk/pull/3184 (... but that was only released with v7.15.1).
@notVitaliy Can you confirm that this indeed already broke with v7.10? Thank you.
Yep, I was able to re-create the issue starting with 7.10.
@var-const I'll get back to you on those questions sometime tomorrow.
I have had this issue for a while now, but have ignored it as I didn't know how to fix it. Strangely, it only appears to happen on Windows for me. Linux does not have the issue.
I have the same problem, auth is looping https://securetoken.googleapis.com/v1/token?key=...
until error: {code: 400, message: "QUOTA_EXCEEDED", status: "INVALID_ARGUMENT"}
@Xstyler85 What version of Firestore are you using?
@schmidt-sebastian I'm using "@firebase/app": "^0.6.6" I will try to update.
The latest version of Firestore has a number of changes that should improve our authentication state handling. Please let us know if you can reproduce using a newer version.
@schmidt-sebastian upgrading on version "0.6.8" solved all problems for me.
Thank you for your help!
Closing as there are no active reports.
If more reports surface, we may want to merge https://github.com/firebase/firebase-js-sdk/pull/3260
@schmidt-sebastian I'm very sorry, but I was looking at the "JS" filter instead of the "XHR" filter by mistake.
It's a little different, now It's looping auth.esm.js:204 and index.esm.js:906
@Xstyler85 Can you clarify what index.esm.js are you referring to? What version?
Line 906 of @firebase/[email protected] is toBase64(), which seems unlikely.
We're facing the same issue in our app, we use auth.onIdTokenChanged() and in Sentry we frequently see the quota error following many calls to securetoken.googleapis.com/v1/token.
Forgot to mention, perhaps very important for a possible fix, is that we use firebase, not firestore.
@Redmega Do you not use firestore at all? Or via @firebase/firestore?
Not at all. This is solely with the firebase base package (and the realtime database), which makes me think that maybe this is a deeper rooted issue in the auth package (or the interfaces by which the realtime database and firestore communicate with auth.
If it helps I can confirm all the rest of the details are the same -- It seems to only affect _some_ Windows users, regardless of browser.
It also interferes with sign in's, though this might be a result of googleapis and not the sdk -- the user is kicked back to the login page after the id token errors out (due to application logic when missing an authed user), and when they attempt to login the call to auth.signInWithEmailAndPassword() _also_ gets blocked due to quota.
Have the same issue with infinite loop of get token requests after google sign in (signInWithPopup). Windows 10, firebase/app 0.6.10. https://github.com/s-pyadyshev/sdsh-react-mobx
cc @avolkovi Adding Alex, since this seems to no longer be Firestore specific. Note that there might not be much we can do here, but the good news is that we are rewriting Firebase Auth from scratch.
This issue is still happening for me on Windows. Thank you for looking more into this.
Have same issue with firebase/auth and signInWithEmailAndPassword on vue js making authentication impossible
Once signInWithEmailAndPassword called infinite calls to firebase are made until error:
{
"error": {
"code": 400,
"message": "QUOTA_EXCEEDED",
"status": "INVALID_ARGUMENT"
}
}

@lymeo I am experiencing exactly this on mac + chrome.
Got the same issue on linux, it went away after correcting my system timezone setting which was incorrect.
Got the same issue on linux, it went away after correcting my system timezone setting which was incorrect.
I think you may be onto something. It's never happened for me on Linux, but I know Windows and Linux store dates differently. So this could be part of the issue.
iMac - Catalina 10.15.7
MacBookPro - Catalina 10.15.7
Is there any update?
Have same issue with
firebase/authandsignInWithEmailAndPasswordon vue js making authentication impossibleOnce
signInWithEmailAndPasswordcalled infinite calls to firebase are made until error:{ "error": { "code": 400, "message": "QUOTA_EXCEEDED", "status": "INVALID_ARGUMENT" } }
Similar to your problem. I have a NextJs app.
Got the same issue on linux, it went away after correcting my system timezone setting which was incorrect.
Fixed time zone in my iMac everything back to normality now.
Same, on windows only with @firebase 7.22.0 has this problem but 7.9.3 works fine.
I have a dual boot with debian next to windows and the date on my windows was incorrect, it was fixed after i set the correct date and time. Maybe it can help you to solve this issue.
Got the same issue on linux, it went away after correcting my system timezone setting which was incorrect.
Fixed time zone in my iMac everything back to normality now.
@JuxhinB
Are we sure that this is a potential fix?
Customers of the product I'm working on are running into that same issue.
Ok confirmed with our customer: it was a clock skew issue on their end 🤦♂️
Another reproduction:
https://stackblitz.com/edit/firebase-issue-sandbox-iuvdtf?file=index.js
/token and /channel./token and /channel constantly in the network tab.If you press log out, you will no longer see those requests.
This amount of requests will result in quota exceed errors and high read counts thus a crazy increase in bills and bad UX.
This issue should be fixed and handled in the SDK. Otherwise, any person with harmful intentions can just use this exploit to cause high bills.
Are you kidding me??!!! It was the timezone?!?!?
Just did a new Windows install (not for this issue) and ran into this issue not realizing my timezone was wrong (Thank you Microsoft for defaulting to Pacific Time.....Windows tries to enable every other configuration, but stopped at "Set time zone automatically", really!!!???? someone please buy me a Chromebook!!!).
Spent all day troubleshooting trying to figure out why it was working on some machines and not others. FWIW, my issue occurred when a user is authenticated and I run firebase.firestore() and it doesn't have to be in that order. Also, I narrowed it down to starting in 7.11 and I don't have the issue in 7.10. Thought it might be related to the "Added multi-factor authentication support for Google Cloud Identity Platform projects." feature added in 7.11
Even built a nice test site here: https://apaggello.web.app/
The looping URL for anyone searching this is https://securetoken.googleapis.com/v1/token?key=xxxxxxxxxx
Please fix it for the sanity of the next person that might run into this, thank you!!!!
Got the same issue on linux, it went away after correcting my system timezone setting which was incorrect.
Fixed time zone in my iMac everything back to normality now.
@JuxhinB
Are we sure that this is a potential fix?
Customers of the product I'm working on are running into that same issue.
Sorry for the late reply, but yes, this fixed the problem for me. I spent more than half a day to understand why in my laptop I didn't have the issue while on pc I did.
Most helpful comment
Have same issue with
firebase/authandsignInWithEmailAndPasswordon vue js making authentication impossibleOnce
signInWithEmailAndPasswordcalled infinite calls to firebase are made until error: