小编use*_*571的帖子

获取 Firebase 电话身份验证 OTP 时出错

我正在尝试实施 Firebase 电话验证。我在 firebase 控制台上启用了电话验证。我已生成密钥库并将 SHA 签名添加到控制台。

依赖:

dependencies {
    def multidex_version = "2.0.1"
    implementation platform('com.google.firebase:firebase-bom:26.0.0')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.firebase:firebase-analytics'
    implementation "androidx.multidex:multidex:$multidex_version"
    implementation 'com.google.firebase:firebase-auth'
    implementation 'com.google.firebase:firebase-core'
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'

}
Run Code Online (Sandbox Code Playgroud)

phone_verification.dart

                await FirebaseAuth.instance.verifyPhoneNumber(
                  phoneNumber: '+1234567890',

                  verificationCompleted: (PhoneAuthCredential credential) {
                    print('verificationCompleted');
                    
                  },
                  verificationFailed: (FirebaseAuthException e) {
                    print('verificationFailed');
                    if (e.code == 'invalid-phone-number') {
                      print('The provided phone number is not valid.');
                    }
                    else {
                      print('Some error occoured: $e');
                    }
                  },
                  codeSent: (String verificationId, int resendToken) async {
                    print('codeSent');

                    // Update the UI …
Run Code Online (Sandbox Code Playgroud)

java authentication android firebase flutter

10
推荐指数
3
解决办法
6894
查看次数

标签 统计

android ×1

authentication ×1

firebase ×1

flutter ×1

java ×1