NativeScript / NativeScript/firebase

Phone authentication hangs on iOS with @nativescript/firebase 5.0.2

オープン
#284 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
62
フォーク
53
平均マージ
8日 4時間
マージ済み PR(30日)
2

説明

I have upgraded my app to the latest version of everything, namely NativeScript 8.9.2, @nativescript/firebase 5.0.2, macOS Sequoia 16.6.1, Xcode 16.4, etc. I can log in on Android devices and simulators (with test numbers) successfully, as I had before the upgrade. On iOS, however, the login hangs after entering the verification code from the SMS message. The Firebase UI completes, in that my login screen is displayed, but control is never returned. This is the code I use to initiate the login:

let idp = await firebase().ui().show({ providers: [new PhoneProvider()] });

In addition to the hang, I also receive the two silent notifications shown below.

app-root.js: handleMsg: message: {
    "foreground": true,
    "data": {
        "com.google.firebase.auth": {
            "warning": "This fake notification should be forwarded to Firebase Auth."
        }
    }
}

app-root.js:61 app-root.js: handleMsg: message: {
    "data": {
        "com.google.firebase.auth": "{\"receipt\":\"AEFDNu9LxA12I0A5Vch7JoTI8XiANEA-viqkiPhRykmcra6aVSCmjVZa5il-Yt4JUh3nbgRzhULnxdKSOEpMQUpcjWr72qkpx3p-ssSSemqDD8l33JdZqN-20Rl5RzU83A\",\"secret\":\"i9pLJ5Ol3WBB17Ol\"}"
    },
    "notification": {
        "apple": {}
    },
    "contentAvailable": 1,
    "foreground": true,
    "messageId": "1757287521614594"
}

I found this information in the Firebase docs:

When you call verifyPhoneNumber(_:uiDelegate:completion:), Firebase sends a silent push notification to your app, or issues a reCAPTCHA challenge to the user. After your app receives the notification or the user completes the reCAPTCHA challenge, Firebase sends an SMS message containing an authentication code to the specified phone number and passes a verification ID to your completion function. You will need both the verification code and the verification ID to sign in the user.

I'm guessing that the secret property is the verification ID, but if so, I don't see how I can couple that with the verification code since they are on different threads.

Is anyone successfully using phone authentication with @nativescript/firebase 5.0.2?

I've included my package.json, build.xcconfig and Podfile contents below.

package.json

{
  "name": "festivelo",
  "main": "app/app.js",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "@bradmartin/nativescript-urlhandler": "^2.0.1",
    "@master.technology/permissions": "^2.0.1",
    "@nativescript-community/ui-collectionview": "^6.0.4",
    "@nativescript-community/ui-material-bottom-navigation": "^7.2.71",
    "@nativescript/appversion": "^2.0.0",
    "@nativescript/contacts": "^3.0.0",
    "@nativescript/core": "~8.9.7",
    "@nativescript/email": "^2.1.0",
    "@nativescript/firebase-auth": "^5.0.2",
    "@nativescript/firebase-core": "^5.0.2",
    "@nativescript/firebase-database": "^5.0.2",
    "@nativescript/firebase-messaging": "^5.0.2",
    "@nativescript/firebase-ui": "5.0.2",
    "@nativescript/geolocation": "^9.0.0",
    "@nativescript/google-maps": "1.7.2",
    "@nativescript/iqkeyboardmanager": "^2.1.2",
    "@nativescript/pdf": "^2.0.0",
    "@nativescript/theme": "^3.1.0",
    "@triniwiz/nativescript-toasty": "^4.1.3",
    "@wuilmerj24/store-update": "^1.0.7",
    "assert": "^2.1.0",
    "base-64": "^1.0.0",
    "browserify-zlib": "^0.2.0",
    "buffer": "^6.0.3",
    "crypto-browserify": "^3.12.0",
    "https-browserify": "^1.0.0",
    "nativescript": "^8.9.3",
    "nativescript-app-tour": "^4.0.0",
    "nativescript-bitmap-factory": "^1.8.1",
    "nativescript-clipboard": "^2.1.1",
    "nativescript-danem-google-maps-utils": "^1.0.18",
    "nativescript-drop-down": "6.0.2",
    "nativescript-phone": "^3.0.3",
    "nativescript-screenshot": "^0.0.2",
    "nativescript-sqlite": "^2.8.6",
    "nativescript-ui-listview": "^15.2.3",
    "nativescript-ui-sidedrawer": "^15.2.3",
    "os-browserify": "^0.3.0",
    "patch-package": "^8.0.0",
    "path": "^0.12.7",
    "path-browserify": "^1.0.1",
    "querystring-es3": "^0.2.1",
    "stream-browserify": "^3.0.0",
    "stream-http": "^3.2.0",
    "tty-browserify": "^0.0.1",
    "url": "^0.11.3"
  },
  "devDependencies": {
    "@nativescript/android": "8.9.1",
    "@nativescript/ios": "8.9.2",
    "@nativescript/webpack": "^5.0.18",
    "util": "^0.12.5"
  },
  "scripts": {
    "postinstall": "patch-package"
  }
}

build.xcconfig

// You can add custom settings here
// for example you can uncomment the following line to force distribution code signing
// CODE_SIGN_IDENTITY = iPhone Distribution 
// To build for device with XCode you need to specify your development team.
DEVELOPMENT_TEAM = xxxxxxxxxx
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
TARGETED_DEVICE_FAMILY = 1;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;

CODE_SIGN_ENTITLEMENTS = festivelo/festivelo.entitlements

// See https://stackoverflow.com/questions/66105038/referenceerror-metadata-for-googlemaps-gmsgeometrydistance-found-but-symbol-n
STRIPFLAGS=$(inherited) -s ${PROJECT_DIR}/../../App_Resources/iOS/exportedSymbols.txt
EXPORTED_SYMBOLS_FILE = ${PROJECT_DIR}/../../App_Resources/iOS/exportedSymbols.txt

// See https://github.com/msywensky/nativescript-phone/issues/51
OTHER_LDFLAGS = $(inherited) -framework MessageUI

// See https://github.com/NativeScript/NativeScript/issues/8860
EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8
EXCLUDED_ARCHS=$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))

Podfile


platform :ios, '15.0'

post_install do |installer|
  installer.pods_project.targets.each do |target|
    puts "Pods target name: " + target.name

    # bypass xcode 16 error
    # see https://stackoverflow.com/questions/78608693/boringssl-grpc-unsupported-option-g-for-target-arm64-apple-ios15-0
    if target.name == 'BoringSSL-GRPC'
      target.source_build_phase.files.each do |file|
        if file.settings && file.settings['COMPILER_FLAGS']
          flags = file.settings['COMPILER_FLAGS'].split
          flags.reject! { |flag| flag == '-GCC_WARN_INHIBIT_ALL_WARNINGS' }
          file.settings['COMPILER_FLAGS'] = flags.join(' ')
        end
      end
    end

    target.build_configurations.each do |config|

      # suppress warnings
      # see https://discord.com/channels/603595811204366337/828973466534936637/1192028592255799317
      config.build_settings['GCC_WARN_INHIBIT_ALL_WARNINGS'] = 'YES'

      # see https://github.com/NativeScript/NativeScript/issues/10034
      if config.build_settings['WRAPPER_EXTENSION'] == 'bundle'
        config.build_settings['DEVELOPMENT_TEAM'] = 'C424ZH53NJ'
      end

      # see https://github.com/NativeScript/NativeScript/issues/8860
      # see https://www.jessesquires.com/blog/2020/07/20/xcode-12-drops-support-for-ios-8-fix-for-cocoapods/
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.0'

      # see https://stackoverflow.com/questions/63607158/xcode-building-for-ios-simulator-but-linking-in-an-object-file-built-for-ios-f/63714000#63714000
      config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"

      # see https://github.com/CocoaPods/CocoaPods/issues/12012
      xcconfig_path = config.base_configuration_reference.real_path
      xcconfig = File.read(xcconfig_path)
      xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
      File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }

      if target.name == 'Realm'
        create_symlink_phase = target.shell_script_build_phases.find { |x| x.name == 'Create Symlinks to Header Folders' }
        create_symlink_phase.always_out_of_date = "1"
        puts "target.name = Realm found"
      end
  
      # See https://stackoverflow.com/questions/61980618/getting-a-new-build-error-for-ios-nativescript
      if ['Toast-Swift'].include? target.name
        target.build_configurations.each do |config|
          config.build_settings['SWIFT_VERSION'] = '5.3'
        end
      end
  
      if ['FirebaseCoreInternal'].include? target.name
        target.build_configurations.each do |config|
          config.build_settings['SWIFT_VERSION'] = '5.3'
        end
      end
  
      if ['FirebaseStorage'].include? target.name
        target.build_configurations.each do |config|
          config.build_settings['SWIFT_VERSION'] = '5.3'
        end
      end

      # Hack to see if this works with Firebase 5.0.3
      if ['FirebaseAuth'].include? target.name
        target.build_configurations.each do |config|
          config.build_settings['SWIFT_VERSION'] = '5.3'
        end
      end
  
      if target.name.start_with? "GoogleDataTransport"
        target.build_configurations.each do |config|
          config.build_settings['CLANG_WARN_STRICT_PROTOTYPES'] = 'NO' 
        end
      end

    end
  end
end

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

app-root.js のメッセージ処理と @nativescript/firebase-ui の phone-auth エントリポイントから始め、参照されている Firebase iOS phone-auth フローと併せて package.json、build.xcconfig、Podfile を確認します。提供されたバージョンで iOS 上に再現し、SMS 検証を完了すると show() から戻り、報告されたハングが発生せずユーザーがサインイン済みのままになることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
firebase, ios, typescript
領域
authentication, mobile
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。