Expo + Firebase authentication (Identity Toolkit) API key android restriction

Please provide the following:

  1. SDK Version: 42.0.0
  2. Platforms(Android/iOS/web/all): Android

In short: Can android app, done with Expo, using Firebase authentication (Identity Toolkit) API key be restricted to use android app?

I have an android application that uses Firebase’s services. I have added android application in my Firebase project and tried to restrict the android application auto generated key (in Google console) but have not been successful.

-I have used Using Firebase - Expo Documentation for Firebase SDK setup .

-Downloaded google-service.json, added it to root of project (same level that app.json is in) and defined it in app.json “expo.android.googleServicesFile”: “./google-services.json”.

-And at the Google console to the autogenerated api key for my Firebase project’s android app:
–I have defined “Android apps” application restrictions ,
–added Package name from app.json “expo.android.package”
–and gotten the SHA-1 certificate fingerprint from https://expo.dev/accounts/{username}/projects/{project}/credentials
Classic Android Credentials: Build Credentials: SHA-1 Certificate Fingerprint .

I have not yet added the application to Google Play.

I have been able to restrict Maps SDK for Android and Geocoding API with just adding package name and SHA-1 certificate to Google credentials console so I’m puzzled why this does not work.

Thank you for all the help!

-Now I recreated android project in Firebase and it connected to existing api key on GCP (the one I use for Maps and Geocoding with working restriction). So I changed the key used in my android project to correspond the api key and now I get a new error message when trying to login :

FirebaseError: Firebase: Error (auth/requests-from-this-android-client-application-<empty>-are-blocked.).

I’m testing on Expo Go so now I will test if this works on build APK.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.