invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.7k stars 2.22k forks source link

Phone/SMS Auth - enable reCAPTCHA flow for devices with push notifications disabled #461

Closed southerneer closed 7 years ago

southerneer commented 7 years ago

Issue

In #119 there was some mention of the fallback reCAPTCHA flow from the Firebase Auth docs. Is it (or should it be) possible to trigger with the latest v3 of react-native-firebase?

The Firebase docs make it sound like it should "just work" in iOS by adding the REVERSED_CLIENT_ID from GoogleService-Info.plist to URL Types in XCode. image

For devices with push notifications disabled (or simulators) the reCAPTCHA flow should be the fallback option, but I haven't been able to get it to work with react-native-firebase.

My setup works flawlessly on physical devices with push notifications enabled, but when I try to login with a phone number on my simulator I get the following error: "There seems to be a problem with your project's Firebase phone number authentication set-up, please make sure to follow the instructions found at https://firebase.google.com/docs/auth/ios/phone-auth". I've added the REVERSED_CLIENT_ID per the instructions, but at this point it's difficult to tell if the problem lies with react-native-firebase or something I'm still missing in my code.

Environment

  1. Application Target Platform: iOS
  2. Development Operating System: macOS Sierra
  3. Build Tools: Xcode 9.0
  4. React Native version: 0.47.2
  5. RNFirebase Version: 3.0.0-alpha.5
  6. Firebase Module: auth
Salakar commented 7 years ago

@southerneer I've been going through the motions of documenting / testing this end to end for the past couple hours, I'll respond once I've either confirmed the full process works or if I have to fix anything along the way.

southerneer commented 7 years ago

Great, let me know if you need me to test anything on my end. I'm actively working on this today too.

southerneer commented 7 years ago

@Salakar I figured out what was missing from react-native-firebase, will submit a PR in a few minutes

Salakar commented 7 years ago

Ah, awesome :)

southerneer commented 7 years ago

Never mind, it was already good...

https://github.com/invertase/react-native-firebase/blob/master/ios/RNFirebase/auth/RNFirebaseAuth.m#L660

Looks like you added the UIDelegate:nil bit in a commit yesterday. That enabled the reCAPTCHA. Please publish to npm when you get a chance. And thanks for all your hard work!

Salakar commented 7 years ago

Ah yes I did that change yesterday (https://github.com/invertase/react-native-firebase/commit/797780f795074cc18be4370768e50c8e0e370821), which means it's already on npm - the full v3 version has been out since the launch of Cloud Firestore

Salakar commented 7 years ago

Out of interest, are you using signInWithPhoneNumber or verifyPhoneNumber?

Would you be able to give verifyPhoneNumber number a go if you haven't already used it, be good to get a couple other devices trying it. https://github.com/invertase/react-native-firebase/issues/119#issuecomment-331716624 Is the writeup of it - see the Basic Example bit - ios specific implementation

Edit: having said that, I only pushed up verify as part of the full v3, doh - so once you've upgraded then if possible can you give it a go, ta.

southerneer commented 7 years ago

~Using both...the app I'm working on uses Firebase Auth as the only auth solution (and as we're in the process of submitting to the app store we're getting rejected because there was no alternative for phones with push notifications disabled). I'll be testing this thoroughly for the next couple hours and will post here if anything unexpected turns up.~

I misspoke, we're only using signInWithPhoneNumber at the moment. It'll be a bit before I can test verifyPhoneNumber

Salakar commented 7 years ago

Ok, no worries, feel free to make another issue if you come across any issues. We're also all on discord.

southerneer commented 7 years ago

@Salakar what did you mean by "I only pushed up verify as part of the full v3"? Should I therefore switch to using verifyPhoneNumber? We're in the process of getting through App Store review and keep getting rejected because the Apple testers never receive the SMS. They get past the verification step (where they would either get a background push notification or get the reCAPTCHA challenge) so that's all good, but they never get the SMS after that step.

I'm going to implement verifyPhoneNumber on my end and see if that makes any difference.

chrisbianca commented 7 years ago

I believe that @Salakar merely meant that verifyPhoneNumber was added after signInWithPhoneNumber as a more customisable version of the functionality. His change should have enabled reCAPTCHA support so I believe that this can be closed as solving the initial problem.

If you're experiencing other problems, could you open a new issue with details?

southerneer commented 7 years ago

Gotcha, thanks for clarifying @chrisbianca . At the time I reopened this issue I was grasping at straws because our app was getting rejecting from the Apple App Store. The tester/reviewer couldn't get the expected SMS (or so they claimed). Once a different tester tried the app, though, everything magically resolved itself so I think it was more user error than anything that was wrong with Firebase or react-native-firebase.

ankit-kachhwaha commented 6 years ago

how can I disable robot captcha on firebase for IOS app

fullstact69 commented 5 years ago

I can't receive the verification code from firebase . How can i resolve this?