firebase phone auth与MISSING_CLIENT_IDENTIFIER失败

时间:2017-10-16 07:40:28

标签: android firebase firebase-authentication firebaseui

我正在尝试从数字转移到firebase auth,我使用Android studio firebase工具在我的应用中配置firebase设置。我正在尝试使用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);

        }
    });

现在,当我点击auth按钮时,我输入了电话号码ui并输入了我的电话号码,但是当我点击验证我的电话号码时...我得到一个弹出窗口说出现内部错误[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。还有其他人遇到过这个吗?

1 个答案:

答案 0 :(得分:0)

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

您正在测试的情况很奇怪,并且一切工作都很好,然后您开始使用白名单中的电话号码进行测试,与此同时,您看到的验证码令人讨厌,因此您发现了禁用验证码的文档化代码。现在,经过数周的测试,您回到生产电话号码时才发现此错误,而没有导致原因的信息。 ;)

[FIRAuth auth].settings.appVerificationDisabledForTesting = YES;

^将此设置恢复为“否”,一切都会很好!