我正在使用适用于Android的FirebaseUI,并且"使用Facebook登录"和#34;使用电子邮件登录"方法工作正常,但"使用Google登录"不起作用。当我点击它时它要求我选择一个帐户,我选择我的gmail帐户,它显示一个加载微调器一秒钟,然后再次回到登录屏幕,就像没有发生任何事情。
查看logcat日志,我可以看到:
07-19 20:21:40.660 3345-12614/? V/BaseAuthAsyncOperation: access token request successful
07-19 20:21:40.661 3345-12614/? V/AuthAccountOperation: id token is requested.
07-19 20:21:40.777 20330-20330/? W/InstanceID/Rpc: Found 10013
07-19 20:21:40.889 3345-12614/? E/TokenRequestor: You have wrong OAuth2 related configurations, please check. Detailed error: INVALID_AUDIENCE
07-19 20:21:40.890 3345-12614/? D/AuthAccountOperation: id token request failed.
我发布了this帖子,并确保在我的Firebase项目中启用了Google登录方法,并且我已添加了正确的SHA-1密钥(尝试使用调试和发布密钥)。
这是我的build.gradle:
apply plugin: 'com.android.application'
android {
signingConfigs {
signing {
...
}
}
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com..."
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
signingConfig signingConfigs.signing
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.signing
}
debug {
signingConfig signingConfigs.signing
}
}
productFlavors {
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
// Module dependency on ParseUI libraries sources
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:preference-v7:23.2.1'
compile 'com.google.android.gms:play-services-maps:9.2.0'
compile 'com.google.android.gms:play-services-location:9.2.0'
compile 'com.google.android.gms:play-services-places:9.2.0'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:support-annotations:23.2.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:recyclerview-v7:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.google.maps.android:android-maps-utils:0.3.4'
//Firebase
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.google.firebase:firebase-database:9.2.0'
compile 'com.google.firebase:firebase-auth:9.2.0'
compile 'com.google.firebase:firebase-crash:9.2.0'
compile 'com.firebaseui:firebase-ui-auth:0.4.2'
//Geofire
compile 'com.firebase:firebase-client-android:2.5.0+' // Remove this once geofire updates to 1.2 to support firebase 3.0
compile 'com.firebase:geofire:1.1.0'
compile 'com.github.lsjwzh.RecyclerViewPager:lib:v1.1.0-beta5'
compile 'com.squareup.okhttp3:okhttp:3.4.0-RC1'
}
apply plugin: 'com.google.gms.google-services'
这就是我启动AuthUI的方式
startActivityForResult(
AuthUI.getInstance()
.createSignInIntentBuilder()
.setLogo(R.drawable.logo)
.setProviders(
AuthUI.EMAIL_PROVIDER,
AuthUI.GOOGLE_PROVIDER,
AuthUI.FACEBOOK_PROVIDER)
.build(),
RC_SIGN_IN);