相关疑难解决方法(0)

尝试使用firebase验证电话号码时出现"无效令牌"

这是我的代码:

import FirebaseAuth


class AuthPhoneNum {

    static func getPhoneNum(phoneNumber: String) {
        PhoneAuthProvider.provider().verifyPhoneNumber(phoneNumber) { (verificationID, error) in
            if let error = error {
                print(error)
                return
            }
            UserDefaults.standard.set(verificationID, forKey: "authVerificationID")
        }
    }

    static func verify(verificationCode: String?) {
        guard let verificationID = UserDefaults.standard.string(forKey: "authVerificationID") else { return }
        if verificationCode != nil {
            let credential = PhoneAuthProvider.provider().credential(
                withVerificationID: verificationID,
                verificationCode: verificationCode!)

            Auth.auth().signIn(with: credential) { (user, error) in
                if let error = error {
                    print(error)
                    return
                }
            }
        } else {
            print("No verification code") …
Run Code Online (Sandbox Code Playgroud)

ios firebase swift firebase-authentication swift3

15
推荐指数
5
解决办法
1万
查看次数

"Invalid Token" when trying to authenticate in IOS real device

Hi have tried to use the phone authentication from firebase, but it is failing. I have read a lot of question regarding this problem and most of them mentioned to create the apn key in developer.apple.com

Maybe that could work, but the thing is that I have used the phone authentication in another apps that have access to the same firebase project and I didn't add any apn key.

在此输入图像描述

For "Delivery Clientes" I can authenticate using phone number, but for …

ios firebase-authentication flutter

2
推荐指数
1
解决办法
5571
查看次数

标签 统计

firebase-authentication ×2

ios ×2

firebase ×1

flutter ×1

swift ×1

swift3 ×1