firebase phone authing失败,有MISSING_CLIENT_IDENTIFIER。

问题描述 投票:3回答:1

我正试图从数字转向火碱地认证,我已经使用Android studio火碱地工具在我的应用程序中配置火碱地设置。我试图使用firebase auth ui来进行手机验证。

我的代码是

authButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            startActivityForResult(
                    AuthUI.getInstance()
                            .createSignInIntentBuilder()
                            .setAvailableProviders(
                                    Arrays.asList(
                                            new AuthUI.IdpConfig.Builder(AuthUI.PHONE_VERIFICATION_PROVIDER).build()
                                    ))
                            .build(),
                    RC_SIGN_IN);

        }
    });

现在,当我点击认证按钮时,我得到了电话号码输入界面,我输入了我的电话号码,但是当我点击验证我的电话号码时......我得到了一个弹出窗口,说发生了内部错误[MISSING_CLIENT_IDENTIFIER]。

按照要求,我的gradle文件。

apply plugin: 'com.android.application'

android {

compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
    applicationId "com.app.id"
    minSdkVersion 16
    targetSdkVersion 25
    versionCode 258
    versionName "1.2.40"
}
buildTypes {
    staging {
        applicationIdSuffix ".staging"
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        buildConfigField "boolean", "IS_STAGING", "true"
        signingConfig signingConfigs.configstaging
        debuggable true
    }
    release {
        signingConfig signingConfigs.releaseConfig
    }
}
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}
    repositories {
        mavenCentral()
        maven { url "https://urbanairship.bintray.com/android" }
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    }
}

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        // The Fabric Gradle plugin uses an open ended version to react
        // quickly to Android tooling updates
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    // Urban Airship SDK
    // Recommended for in-app messaging
    //    compile 'com.google.android.gms:play-services-analytics:9.2.0'
//    compile('com.digits.sdk.android:digits:1.11.1@aar') {
//        transitive = true;
//    }
    compile('com.crashlytics.sdk.android:crashlytics:2.6.1@aar') {
        transitive = true;
    }
    compile 'info.hoang8f:android-segmented:1.0.6'
    compile 'com.urbanairship.android:urbanairship-sdk:8.6.+'
    compile 'com.google.android.gms:play-services-gcm:11.0.1'
    compile 'com.android.support:cardview-v7:25.3.1'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
    compile 'com.google.android.gms:play-services-location:11.0.1'
    compile 'com.google.android.gms:play-services-maps:11.0.1'
    compile 'com.google.code.gson:gson:2.4'
    compile 'net.danlew:android.joda:2.9.9'
    compile 'com.android.support:support-v13:25.3.1'
    compile 'org.apache.commons:commons-lang3:3.4'
    compile 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    compile 'com.prolificinteractive:material-calendarview:1.4.3'
    compile 'com.rollbar:rollbar-android:0.2.0'
    compile 'com.google.firebase:firebase-auth:10.0.1'
    testCompile 'junit:junit:4.12'
    testCompile 'org.robolectric:robolectric:3.4.2'
    compile 'com.firebaseui:firebase-ui-auth:2.0.1'
    compile 'com.appsee:appsee-android:+'
}


apply plugin: 'com.google.gms.google-services'

我的onActivityResult从来没有被击中。我试着调试了一下,我使用的是一个实际的设备而不是模拟器。我在我的firebase项目中也添加了SHA1。有人遇到过这种情况吗?

android firebase firebase-authentication firebaseui
1个回答
0
投票

我终于解决了这个问题,非常令人沮丧的是,firebase没有记录这样一个常见的问题。

估计你在测试的时候,一切都很正常,然后你开始用一个白名单的电话号码进行测试,在测试的时候,你遇到了验证码,这让你很恼火,所以你找到了文档化的代码来禁用验证码。现在,经过几个星期的测试后,你回到生产电话号码,却发现这个错误,而不知道是什么原因。)

[FIRAuth auth].settings.appVerificationDisabledForTesting = YES;

^把这个设置回NO,你就可以了!

© www.soinside.com 2019 - 2024. All rights reserved.