0

When Firebase Authentication is run in an emulator, the following error is triggered:

This app is not authorized to use Firebase Authentication. Please verify that the correct package name and SHA-1 are configured in the Firebase Console.

How does Firebase detect if an emulator is being used?

EDIT: I'm meant to refer specifically to phone auth.

John M.
  • 2,642
  • 7
  • 26
  • 55

1 Answers1

0

it doesn't matter if it uses an emulator, the OS is the same as a normal device, I have been running firebase Auth with email and password, Gmail, Facebook and github and never had a problem before.

Sometimes emulators have an old version of Google Play Services or sometimes they never have it installed, you should check if you have GPS installed and running in your emulator, and update the system images with your current API build tools.

Gastón Saillén
  • 12,319
  • 5
  • 67
  • 77
  • Are you sure about this? According to the [docs](https://firebase.google.com/docs/auth/android/phone-auth), "Also, note that phone number sign-in requires a physical device and won't work on an emulator." – John M. Jul 08 '18 at 03:02
  • yes, just for phone auth it wont work since it needs any sort of GSM signal – Gastón Saillén Jul 08 '18 at 03:03
  • So, it detects if a physical device is being used by looking for GSM signals? Doesn't the emulator already emulate GSM signals? – John M. Jul 08 '18 at 03:04
  • you need to set them up in your bash console, first connect to the adv with telnet localhost 5554 and then simulate the gsm signals with network delay umts network speed umts – Gastón Saillén Jul 08 '18 at 03:06
  • I see. Thanks a lot. – John M. Jul 08 '18 at 03:08
  • also, there is the IMEI of the current device, so it should return what you are using, check this doc https://developer.android.com/reference/android/telephony/TelephonyManager#getDeviceId%28%29 – Gastón Saillén Jul 08 '18 at 03:09
  • Sure, but I believe the IMEI can be easily faked. – John M. Jul 08 '18 at 03:11
  • you can check this question https://stackoverflow.com/questions/6864251/how-to-find-out-from-code-if-my-android-app-runs-on-emulator-or-real-device – Gastón Saillén Jul 08 '18 at 03:16
  • Actually, are you certain it checks for GSM signals? I've tried switching on flight mode on my phone and leave WiFi on, I can still pass phone auth. – John M. Jul 08 '18 at 05:26