Phone Auth
每月可以免費寄送一萬個認證簡訊。
1.記得先去 Firebase console 開啟 phone auth 服務。

RN 跟 web 不同,不需要 initializeApp()
iOS
2.加入 URL scheme 到 info.plist
open the GoogleService-Info.plist configuration file, and look for the REVERSED_CLIENT_ID key and add to info.plist
例如:
3.可以到下方改變簡訊內容 (非必要)

範例:
之後你的手機會收到簡訊。

Tip: 另外也可以新增測試用號碼,避免重複發送多次後被暫停使用

Android
Androidn 流程稍微比較多
1.加入相關 Gradle script (app/build.gradle)
https://rnfirebase.io/#configure-firebase-with-android-credentials
2.加入 sha 指紋:
獲取 sha1, sha256 hash 後加入 firebase console
3. 加入測試用電話
這邊加入後使用測試電話發簡訊時則不會實際收到簡訊,但如果沒加入測試電話每天只能發 50 個簡訊
可能錯誤
1.
這邊要確認下載 android/app 內的 debug.keystore 裡面的sha1, sha256 是不是就是這把 key的,有時會讀取到根目錄下的 ~/.android/debug.keystore
Last updated
Was this helpful?