I have my app set up to allow users to sign up in firebase with email and password. I’d like to implement passwordless signup, but I am running into walls. Firebase offers both an email-based passwordless sign-up and a phone-number-based method. However, despite react native support for them, neither of them appears to be able to work with Expo (without detaching).
Does anyone know how to make either of these auth systems work in expo? Can it be done without detaching?
You can add RNFirebase by running the following commands:
exp detach
yarn add react-native-firebase && react-native link && cd ios && pod install && cd ..
Then you will want to go into the AppDelegate.m and add this stuff:
#import "AppDelegate.h"
#import "ExpoKit.h"
#import "EXViewController.h"
#import <Firebase.h> /// Import this thing
//@import Firebase; /// Google recommends you use this, but Evan doesn’t!
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[FIRApp configure]; /// Add this at the beginning of the function
…some other code
return YES;
}
Also if you don’t detach the process (for ios/50% android) looks like this:
exp build:ios
curl -O <the download url - which should take 10-20 mins>
// fastlane produce creates the app store app - you may not need this if you already did it
fastlane produce
// this sets up the app store metadata
fastlane deliver init
// this pushes the .ipa (which should be in your project root folder from curl)
// to the app store without needing to use application loader <3 :D!!!!
fastlane deliver
so it’s pretty worth it to stay in expo - but eh…detaching is fine too <#3
Oh, detaching wasn’t ever in the plan — I like expo too much to abandon it over something relatively minor. Even requiring email+password signup isn’t that big of an issue, it just would’ve been nicer to go permanently without a password.
I’m going to go with your option 3 for now, and eventually (sometime past the MVP) roll a custom phone number auth system using Twilio and custom tokens in conjunction with firebase, unless expo adds the firebase direct phone auth functionality natively (which I’m not expecting). I saw someone else on a forum make that work in expo, so at least it’s workable.
Nice, yeah let me know if you get that working. I think the biggest problem with firebase is that it is such a giant stack and it has features that require your app to be a singular instance, not something you can hot-load code in to. (google.plist)
But that said I still take a stab at it at least once a month, one of these days
I usually start all my firebase apps with anon auth now, it cuts a lot of weirdness out of how navigation works, because you can have an auth token before starting the app.
Also the added bonus of no sign-in/commitment before the user has seen your app
You seem to know all this tho mostly for future readers
I haven’t used anon auth before, but it looks like a perfect implementation in a different set of apps of mine. Thanks for the suggestion, it’ll come in handy!