react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

Crash when signInWithPhoneNumber

Open ararog opened this issue 9 years ago • 12 comments

I'm trying to use signinWithPhoneNumber, but it is always crashing with the following message:

Please register custom URL scheme 'com.googleusercontent.apps.711281515158-jccuuigsa4851bub2f1dfo5qcfihd469' in the app's Info.plist file.' was thrown while invoking signInWithPhoneNumber on target RNFirebaseAuth with params ( "__FIRAPP_DEFAULT", 2392159312, 2538, 2539 )

I followed all steps to configure RNFirebase on the project, from npm package to XCode stuff. What I'm doing wrong?

Environment

  1. Application Target Platform: iOS

  2. Development Operating System: Mac OS High Sierra

  3. Build Tools: XCode 9

  4. React Native version: 0.49.3

  5. RNFirebase Version: 3.0.5

  6. Firebase Module: auth

ararog avatar Oct 27 '17 22:10 ararog

@ararog you need to follow steps 1 & 2 from the official firebase ios docs to add the url schema. Note that this also will not work on an emulator, phone auth requires a physical device.

Link: https://firebase.google.com/docs/auth/ios/phone-auth

Salakar avatar Oct 30 '17 10:10 Salakar

If it helps, when enabling Auth, is required to download the GoogleService-info again.

gusgard avatar Nov 28 '17 17:11 gusgard

Thank you @gusgard, that's not an obvious thing to do and it was just what I needed.

jmhuret avatar Jan 12 '18 21:01 jmhuret

Hey guys, sorry reopening this thread, but I've made the steps 1 and 2 to enable silent notifications, but my react native app is crashing asking for configure the URL link is need for recaptcha mode. when I configure this url, everything runs fine, but in the middle of the process, firebase still opening the Verifying If you're not a robot.

I definitely need help with that...

lucasfernandes avatar Jan 26 '18 17:01 lucasfernandes

Kind of stuck on this, just tried to setup the phone auth and getting 'Please register custom url scheme'. What should i do?

joshbedo avatar Mar 16 '18 04:03 joshbedo

I fixed it by following the steps in #2 to enable recaptcha verification, specifically:

Add custom URL schemes to your Xcode project:

Open your project configuration: double-click the project name in the left tree view. Select your app from the TARGETS section, then select the Info tab, and expand the URL Types section.

Click the + button, and add a URL scheme for your reversed client ID. To find this value, open the GoogleService-Info.plist configuration file, and look for the REVERSED_CLIENT_ID key. Copy the value of that key, and paste it into the URL Schemes box on the configuration page. Leave the other fields blank.

mypark avatar Apr 12 '18 15:04 mypark

@lucasfernandes I was also surprise there is no guide for that! I just spent the whole afternoon on this silent notifications not working and reCaptcha always showing when authenticating with phone number... I think that should be part of a guide on Medium.com lol

There is more stuff that needs to be done actually and you get it from reading that blog: https://firebase.googleblog.com/2017/01/debugging-firebase-cloud-messaging-on.html

capture d ecran 2018-04-12 a 18 12 20

The additional part that I have missed that helped me to solved this:

  1. Install Cloud Messaging Module from RNFirebase https://rnfirebase.io/docs/v4.0.x/messaging/ios
  2. Install Notifications Module in RNFirebase https://rnfirebase.io/docs/v4.0.x/notifications/ios

Hope it will help someone else

JimTeva avatar Apr 13 '18 04:04 JimTeva

@tevatahiti just tried your suggestion and tried 2. install notifications module and I get the error on #import "RNFirebaseNotifications.h", file not found. I was able to get FCM working, but didn't see an additional pod install for notifications specifically. Am I missing something? Also a bit confused on the overlap between notifications and messaging - I had assumed that messaging also installs remote notifications - is that incorrect?

mypark avatar Apr 13 '18 14:04 mypark

@mypark do you have a version of your app already working with ReCaptcha? If yes then once you installed Cloud Messaging module and Notifications module:

  • xcode : clean derivated data
  • xcode : clean project
  • in pod folder : pod update
  • sometimes it also helps to clean everything and reboot your mac Hope it can help

JimTeva avatar Apr 15 '18 20:04 JimTeva

@tevatahiti rebooting seems to have helped - though I'm not importing notifications, just FCM.

mypark avatar Apr 16 '18 19:04 mypark

Besides, no need to have a real iOS device for testing phone authentication. You just need to set test phone numbers and code in firebase settings.

berpcor avatar Aug 04 '18 19:08 berpcor

@mypark save my day

roy-law avatar Apr 26 '19 05:04 roy-law