Search code examples
androidflutterfirebasegoogle-cloud-firestore

Flutter Firebase require resign in to work


I am using Firebase Auth and Firestore, it works fine but when close the app for a while( more than 30 mins approximately) no firebase code work and i get the following error:

W/System  (12108): Ignoring header X-Firebase-Locale because its value was null.
4
W/LocalRequestInterceptor(12108): Error getting App Check token; using placeholder token instead. Error: com.google.firebase.FirebaseException: No AppCheckProvider installed.
D/TrafficStats(12108): tagSocket(129) with statsTag=0xffffffff, statsUid=-1
3
W/Firestore(12108): (24.11.0) [FirestoreCallCredentials]: Failed to get auth token: com.google.firebase.FirebaseException: An internal error has occurred. [ Requests to this API securetoken.googleapis.com method google.identity.securetoken.v1.SecureToken.GrantToken are blocked. ].
W/Firestore(12108): (24.11.0) [WatchStream]: (1565506) Stream closed with status: Status{code=UNAUTHENTICATED, description=null, cause=com.google.firebase.FirebaseException: An internal error has occurred. [ Requests to this API securetoken.googleapis.com method google.identity.securetoken.v1.SecureToken.GrantToken are blocked. ]
W/Firestore(12108):     at com.google.android.gms.internal.firebase-auth-api.zzach.zza(com.google.firebase:firebase-auth@@22.3.1:18)
W/Firestore(12108):     at com.google.android.gms.internal.firebase-auth-api.zzadg.zza(com.google.firebase:firebase-auth@@22.3.1:21)
.
.
W/Firestore(12108):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
W/Firestore(12108):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
W/Firestore(12108):     at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0$com-google-firebase-concurrent-CustomThreadFactory(CustomThreadFactory.java:47)
W/Firestore(12108):     at com.google.firebase.concurrent.CustomThreadFactory$$ExternalSyntheticLambda0.run(Unknown Source:4)
W/Firestore(12108):     at java.lang.Thread.run(Thread.java:1012)
W/Firestore(12108): }.
W/Firestore(12108): (24.11.0) [OnlineStateTracker]: Could not reach Cloud Firestore backend. Connection failed 1 times. Most recent error: Status{code=UNAUTHENTICATED, description=null, cause=com.google.firebase.FirebaseException: An internal error has occurred. [ Requests to this API securetoken.googleapis.com method google.identity.securetoken.v1.SecureToken.GrantToken are blocked. ]

and no firebase write work till i sign out and sign in again, anyone, i tried the possible solutions Here and Here i am using a real device for debugging

but nothing works, here you can ma package name, and firebase package name enter image description here enter image description here


Solution

  • To solve this for anyone my face the same problem the problem was that the API Key was restricted you have to visit: https://console.cloud.google.com/apis/credentials?project=YOUR_PROJECT_ID select the API key you use and under API restrictions use Don't restrict key