Firebase passwordless signup

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?

1 Like
  1. The phone number method will not work in Expo as it is not included in the WebSDK.
  2. The email approach is janky in firebase, it requires use of dynamic linking which will also require detaching.
  3. I would recommend using anonymous auth + account upgrading. It works pretty well and it will keep you from having to detach.

Upgrade account example: Basic Firebase - Snack
The code is in firebase/Fire.js :smiley: :fire:

Detach + Firebase

The hardest part about detaching in my opinion is signing and uploading an Android app. Everything else is pretty easy :heart:

Checkout my outdated guide: GitHub - EvanBacon/expo-native-firebase: 🔥 Native Firebase Expo App (iOS, Android) Demo for Firestore, Notifications, Analytics, Storage, Messaging, Database 🚨

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;
}

Dynamic Links

You can setup dynamic links by following this guide: https://docs.expo.io/versions/latest/expokit/advanced-expokit-topics#changing-the-deep-link-scheme

Uploading to the store

To upload the iOS app you can simply:

cd ios/
pod install
fastlane init
- Setup private repo for certs
fastlane match init
- Add private repo url
- Add passphrase for certs - “brentisbae”
fastlane match appstore
fastlane release

With android you should be able to follow this guide: Publishing to Google Play Store · React Native
I couldn’t but it’s because I’m not smart.

Finally remember to update your .gitignore to include pods. Example

2 Likes

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.

Appreciate the response!

1 Like

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 :wink:

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 :bomb:

You seem to know all this tho :stuck_out_tongue_winking_eye: mostly for future readers :smiley::fire:

1 Like

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!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.