Android FirebaseUI使用Google错误登录以获取发布密钥 [英] Android FirebaseUI sign in with Google error for release key

查看:92
本文介绍了Android FirebaseUI使用Google错误登录以获取发布密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在获取

I'm getting the the Developer (Code:10, message:10:) error when trying to sign in using Google Sign-in while using FirebaseUI's Authentication. All works well on development, but when I sign my bundle using my upload key and then run it on a device, it fails.

我在这里此处

I looked at associated questions here, here and here and the answers didn't help. As you'll see below, I've tried their recommendations.

我尝试过的事情:

  • Add SHA1 fingerprints to the Project Settings at the Firebase Console for debug, release (upload), and Google Play keys.
  • At console.developers.google.com, created OAuth clients for Android for each of the 3 keys.
  • Still at console.developers.google.com created a new Web client which I then took the Client ID and secret and put it under Firebase's authentication / Google sign in method's Web SDK configuration.
  • Tried all the steps here, here, here, and here
  • Double-checked that my build is actually signed by the correct key (the upload/deploy key)
  • Made sure my google-services.json is the latest with all fingerprints present

我的应用程序级build.gradle文件包含以下内容:

My app-level build.gradle file contains the following:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'

android {

  signingConfigs {
    release {
      storeFile file('myKeystore')
      storePassword 'myPassword'
      keyAlias 'upload'
      keyPassword 'myPassword'
    }
  }
  compileSdkVersion 29

  defaultConfig {
    applicationId "com.######.app"
    minSdkVersion 28
    targetSdkVersion 29
    versionCode 24
    versionName "Test version 1"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    javaCompileOptions {
      annotationProcessorOptions {
        arguments = ["room.schemaLocation":
          "$projectDir/schemas".toString()
        ]
      }
    }
  }

  buildTypes {

    release {
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      signingConfig signingConfigs.release
    }

    debug {
      debuggable true
      signingConfig signingConfigs.debug
    }
  }

  packagingOptions {
    exclude 'META-INF/atomicfu.kotlin_module'
  }
  sourceSets {
    main {
      res {
        srcDirs 'src/main/res', 'src/main/res_birds'
      }
    }
  }
}

dependencies {
    // Jar libs
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    // Kotlin
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    // Support libs
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.1.0'

    // Supernova UI Toolkit
    implementation 'io.supernova:android-ui-toolkit:1.2.0'

    // Play Services
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.gms:play-services-auth:18.0.0'

    // Page Control
    implementation 'com.romandanylyk:pageindicatorview:1.0.0'

    // Unit tests dependencies
    implementation 'com.google.firebase:firebase-auth:19.3.1'
    testImplementation 'junit:junit:4.13'

    // Integration tests dependencies
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    // Room components
    implementation "androidx.room:room-runtime:$rootProject.roomVersion"
    kapt "androidx.room:room-compiler:$rootProject.roomVersion"
    androidTestImplementation "androidx.room:room-testing:$rootProject.roomVersion"

    // optional - Kotlin Extensions and Coroutines support for Room
    implementation "androidx.room:room-ktx:$rootProject.roomVersion"

    // Lifecycle components
    kapt "androidx.lifecycle:lifecycle-compiler:$rootProject.archLifecycleVersion"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$rootProject.archLifecycleVersion"

    // Kotlin components
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$rootProject.coroutines"
    api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.coroutines"

    // Material design
    implementation "com.google.android.material:material:$rootProject.materialVersion"

    // Testing
    testImplementation 'junit:junit:4.13'
    androidTestImplementation "androidx.arch.core:core-testing:$rootProject.coreTestingVersion"

    // Navigation
    implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'
    implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'

    // Stfalcon ImageViewer
    implementation 'com.github.stfalcon:stfalcon-imageviewer:1.0.1'

    // [START gradle_firebase_ui_auth]
    implementation "com.firebaseui:firebase-ui-auth:6.2.1"

    //Firebase
    implementation 'com.google.firebase:firebase-analytics:17.4.3'
    implementation 'com.google.firebase:firebase-core:17.4.3'
    implementation 'com.google.firebase:firebase-firestore-ktx:21.4.3'
    implementation "com.google.firebase:firebase-auth-ktx:19.3.1"


    // Required only if Facebook login support is required
    implementation 'com.facebook.android:facebook-android-sdk:7.0.0'
    // [END gradle_firebase_ui_auth]

}

从Firebase测试实验室设备生成的日志中摘录:

An extract from a log generated by a Firebase Test Lab device:

06-21 12:11:29.915: E/AuthUI(14514): A sign-in error occurred.
06-21 12:11:29.915: E/AuthUI(14514): com.firebase.ui.auth.FirebaseUiException: Code: 10, message: 10: 
06-21 12:11:29.915: E/AuthUI(14514):    at com.firebase.ui.auth.data.remote.GoogleSignInHandler.onActivityResult(GoogleSignInHandler.java:112)
06-21 12:11:29.915: E/AuthUI(14514):    at com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity.onActivityResult(AuthMethodPickerActivity.java:361)
06-21 12:11:29.915: E/AuthUI(14514):    at android.app.Activity.dispatchActivityResult(Activity.java:7462)
06-21 12:11:29.915: E/AuthUI(14514):    at android.app.ActivityThread.deliverResults(ActivityThread.java:4391)
06-21 12:11:29.915: E/AuthUI(14514):    at android.app.ActivityThread.handleSendResult(ActivityThread.java:4440)
06-21 12:11:29.915: E/AuthUI(14514):    at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
06-21 12:11:29.915: E/AuthUI(14514):    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
06-21 12:11:29.915: E/AuthUI(14514):    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
06-21 12:11:29.915: E/AuthUI(14514):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
06-21 12:11:29.915: E/AuthUI(14514):    at android.os.Handler.dispatchMessage(Handler.java:106)
06-21 12:11:29.915: E/AuthUI(14514):    at android.os.Looper.loop(Looper.java:193)
06-21 12:11:29.915: E/AuthUI(14514):    at android.app.ActivityThread.main(ActivityThread.java:6718)
06-21 12:11:29.915: E/AuthUI(14514):    at java.lang.reflect.Method.invoke(Native Method)
06-21 12:11:29.915: E/AuthUI(14514):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
06-21 12:11:29.915: E/AuthUI(14514):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
06-21 12:11:29.916: D/LifecycleMonitor(14514): Lifecycle status change: com.firebase.ui.auth.KickoffActivity@f99b9c3 in: RESUMED
06-21 12:11:29.940: I/GoogleInputMethod(1463): onFinishInput() : Dummy InputConnection bound
06-21 12:11:29.940: I/GoogleInputMethod(1463): onStartInput() : Dummy InputConnection bound
06-21 12:11:29.945: I/Icing(10330): Indexing done com.google.android.inputmethod.latin-internal.3p:StickerPack [CONTEXT service_id=21 ]
06-21 12:11:29.946: I/Icing(10330): Indexing com.google.android.inputmethod.latin-internal.3p:Sticker from com.google.android.inputmethod.latin [CONTEXT service_id=21 ]
06-21 12:11:29.948: D/LifecycleMonitor(14514): Lifecycle status change: com.firebase.ui.auth.KickoffActivity@f99b9c3 in: PAUSED
06-21 12:11:29.962: I/FirebaseUIActivity(14514): Request Code: 123, Result Code: 0
06-21 12:11:29.962: E/FirebaseUIActivity(14514): Sign in failed with response error code: 4, and message: Code: 10, message: 10: 

在下面的屏幕截图中,是我在Firebase控制台上的SHA-1指纹.它们定义为:

In the screenshot below are my SHA-1 fingerprints on the Firebase console. They are defined as:

  • 以A7结尾:调试
  • 以68结尾:发布(apk)
  • 以66结尾:商店(Play商店)

从关键工具获取要发布的签名时,我得到:

When getting the signatures from key tool for release, I get:

在Google Play商店中,我的上传证书显示为:

On Google play store, my upload certificate is shown as:

在Google Play商店中,应用签名证书显示为:

On Google play store, the app signing certificate is shown as:

我的用于上传密钥的OAuth 2客户端显示为:

My OAuth 2 client for my upload key is shown as:

我的google-services.json内容为:

My google-services.json contents are:

{
  "project_info": {
    "project_number": "*******",
    "firebase_url": "**********",
    "project_id": "************",
    "storage_bucket": "************"
  },
  "client": [
    {
      "client_info": {
        "mobilesdk_app_id": "1:77*******:android:*******1e7",
        "android_client_info": {
          "package_name": "com.f***********.app"
        }
      },
      "oauth_client": [
        {
          "client_id": "77************-2u******************.googleusercontent.com",
          "client_type": 1,
          "android_info": {
            "package_name": "com.f***********.app",
            "certificate_hash": "ea#####################################68"
          }
        },
        {
          "client_id": "7****************-do**************.googleusercontent.com",
          "client_type": 1,
          "android_info": {
            "package_name": "com.f***********.app",
            "certificate_hash": "3e#####################################a7"
          }
        },
        {
          "client_id": "7**************-k8**************.googleusercontent.com",
          "client_type": 1,
          "android_info": {
            "package_name": "com.f***********.app",
            "certificate_hash": "d0#####################################66"
          }
        },
        {
          "client_id": "7**************-sf**************.googleusercontent.com",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "AI**************_GQ"
        }
      ],
      "services": {
        "appinvite_service": {
          "other_platform_oauth_client": [
            {
              "client_id": "7**************-sf**************.googleusercontent.com",
              "client_type": 3
            },
            {
              "client_id": "7*********-3**************.googleusercontent.com",
              "client_type": 2,
              "ios_info": {
                "bundle_id": "com.f***********.app",
                "app_store_id": "********"
              }
            }
          ]
        }
      }
    }
  ],
  "configuration_version": "1"
}

任何能在下一步找到什么想法都将受到赞赏.

Any ideas where to look next will be appreciated.

推荐答案

因此...事实证明,可能需要4个(四个)签名密钥... 第四个用于通过Google Play共享内部应用程序(我正在使用).要找到此密钥,您需要导航到Google Play控制台,如下所示:

So... It turns out that there are 4 (FOUR) signing keys that might be needed... The fourth one is for internal app sharing (which I was using) via Google Play. To find this key, you need to navigate to Google Play console as shown below:

将该密钥添加到Firebase控制台设置中,将新的google-services.json下载到您的项目中并运行.

Add that key to your Firebase console settings, download the new google-services.json into your project and run.

这篇关于Android FirebaseUI使用Google错误登录以获取发布密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆