Issue #350

Read Authenticate with Firebase on iOS using a Phone Number

Disable swizzling

Info.plist

<key>FirebaseAppDelegateProxyEnabled</key>
<string>NO</string>

Enable remote notification

Enable Capability -> Background mode -> Remote notification

AppDelegate.swift

import Firebase
import UIKit
import FirebaseAuth

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    private let appFlowController = AppFlowController()

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        UIApplication.shared.registerForRemoteNotifications()
		FirebaseApp.configure()
        return true
    }

    // MARK: - Remote Notification

    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        Auth.auth().setAPNSToken(deviceToken, type: .unknown)
    }

    func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
        print(error)
    }

    func application(
        _ application: UIApplication,
        didReceiveRemoteNotification userInfo: [AnyHashable: Any],
        fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
        completionHandler(.noData)
    }

    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
        if Auth.auth().canHandle(url) {
            return true
        } else {
            return false
        }
    }
}

Firebase push message looks like

▿ 1 element
  ▿ 0 : 2 elements
    ▿ key : AnyHashable("com.google.firebase.auth")
      - value : "com.google.firebase.auth"
    ▿ value : 1 element
      ▿ 0 : 2 elements
        - key : warning
        - value : This fake notification should be forwarded to Firebase Auth.

Captcha

To disable captcha during testing

Auth.auth().settings?.isAppVerificationDisabledForTesting = true