7

I implemented Phone Authentication with Firebase on iOS. Authentication works. However, on iOS, a reCAPTCHA window pops up. I tried to enable Silent Notifications by enabling Background Modes and Push Notifications. It is skipping the reCAPTCHA test but it still pops up a blank page with a loading bar to do the verification automatically. Is there an extra step that I'm missing? Also, I'm new to XCode so I might be missing a configuration step (for example I didn't click any checkboxes on the Background Modes dropdown).

Do you have any suggestions on what I could be missing?

batatop
  • 979
  • 2
  • 14
  • 31

3 Answers3

22

I found the solution. Enabling "Background Modes" capability is not enough. Inside of the "Background Modes", you have to click "Remote Notifictions" checkbox.

I couldn't see that in the documentation.

batatop
  • 979
  • 2
  • 14
  • 31
  • 1
    I followed several forms of documentation, and blog tutorials. None mentioned this at all. This was the only thing that fixed it for me. – SeanMC Dec 17 '21 at 15:50
6

To ensure that both scenarios are working correctly, test your app on a physical iOS device with background app refresh both enabled and disabled. When background app refresh is disabled, you should be able to successfully sign in after completing the reCAPTCHA challenge. You can also test the reCAPTCHA flow by running your app on an iOS simulator, which always uses the reCAPTCHA flow.

For Disable reCAPTCHA Authentication Go and Enabling Background Modes capability Inside of the Background Modes and check "Remote Notification" checkbox.

for more detail refer to the firebase document https://firebase.google.com/docs/auth/ios/phone-auth

Kavin Soni
  • 101
  • 1
  • 3
1

This almost cause me to waste a lot of time. I had previously installed a build from Testflight that was not fully configured to skip the Recaptcha. (the push/background-refresh hadn't been enabled when the build was published)

So I set that and my certs all set up, pushed a new build to Testflight, updated on the phone in testflight, but still saw the recaptcha.

I had to uninstall the app from my phone, and reinstall through testflight again. After that, logging in by phone no longer showed a recaptcha. :)

SeanMC
  • 1,960
  • 1
  • 22
  • 33
  • I have the exact same problem, but re-installing did not work. There is no "Background Modes" on the certificate settings, but I enabled it with "Remote Notification" in the project settings. I also enabled "Push Notifications" in the project settings and in the certificate settings. Still not working. What could I do? – Martin Braun Jun 23 '22 at 16:24
  • @MartinBraun Did you uninstall first before reinstalling? Need to figure out how to get background modes to show up. I think that’s important – SeanMC Jun 24 '22 at 21:14
  • 1
    Yes, I did exactly that and it did not help. Then I decided to test the whole thing in Debug mode without TestFlight. So I uninstalled the app and launched it through XCode directly on the device. This worked. Then I made another new version and published it through TestFlight again and now it is working. Really strange, but it works now. I either messed up or there is some magic happening that I cannot explain. Maybe it took some time to refresh any caches within Firebase. I love when things get solved, I don't when I can't explain them though. – Martin Braun Jun 26 '22 at 00:30