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:
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.
[To see links please register here]
Focus on 2. Enable App Verification and you will notice that recaptcha is just an alternative for SafetyNet.