'Firebase unable to process request due to missing initial state

I am trying to use phone auth from firebase and I get this error now.

Unable to process request due to missing initial state. This may happen if browser session storage is inaccessible or accidentally cleared.

This was working a week ago and no longer works.



Solution 1:[1]

I have solved this by registering my app with SafetyNet with SHA2. To do this follow these steps:

  1. Get your SHA2. If you don't know how to get this, follow this tutorial: https://www.youtube.com/watch?v=kLaNnuoqnmA Note. This youtube link is for SHA1 but you will notice that SHA2 will be shown here if you pay attention.
  2. Go to your Firebase Console then, go to Project Settings > App Check. You will notice your app is "Unregistered." click this to register your app.
  3. Enter the SHA2 you copied and Accept some terms below then click Save. you will notice the "Registered" with green check icon.

Btw, this error happens on one of my devices but not on another. I also searched through this error and no one has solved this including this page. This happens in my phone authentication using firebase when getting an OTP as I send my phone number. The app tries to redirect you to a browser for Recaptcha for verification if you don't have SafetyNet. Thus, having no SafetyNet will cause your app to always be redirected for Recaptcha which sometimes causes an error. Thus, to solve this, register your app with Safety Net. to understand this, read this documentation. https://firebase.google.com/docs/auth/android/phone-auth?authuser=0 Focus on 2. Enable App Verification and you will notice that recaptcha is just an alternative for SafetyNet.

Solution 2:[2]

I experienced the issue with an iphone web app. I went into Settings -> Safari and disabled 'Prevent Cross-Site Tracking'.

Solution 3:[3]

It had on the Ionic/Angular/Capacitor app too. i.e. Android and Chrome. Firebase Auth with Microsoft Login.

So I have cleared all the chrome browser data on the Android device and then no issues. i.e. working fine now.

More workarounds: https://github.com/firebase/firebase-js-sdk/issues/4256

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Meloiii
Solution 2 Chase Buttery
Solution 3 Sampath