Android FirebaseUI与Google的身份验证不起作用
我正在使用FirebaseUI for Android,“使用Facebook登录”和“使用电子邮件登录”方法都可以正常工作,但“使用谷歌登录”不起作用。当我点击它时,它会要求我选择一个帐户,我选择我的gmail帐户,它会显示一个加载微调器一秒钟,然后再次回到登录屏幕,就像什么都没发生一样 查看logcat日志,我可以看到:Android FirebaseUI与Google的身份验证不起作用,android,firebase,firebase-authentication,google-signin,firebaseui,Android,Firebase,Firebase Authentication,Google Signin,Firebaseui,我正在使用FirebaseUI for Android,“使用Facebook登录”和“使用电子邮件登录”方法都可以正常工作,但“使用谷歌登录”不起作用。当我点击它时,它会要求我选择一个帐户,我选择我的gmail帐户,它会显示一个加载微调器一秒钟,然后再次回到登录屏幕,就像什么都没发生一样 查看logcat日志,我可以看到: 07-19 20:21:40.660 3345-12614/? V/BaseAuthAsyncOperation: access token request success
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.
我看过这篇文章,并确保在我的Firebase项目上启用了Google登录方法,并且添加了正确的SHA-1密钥(使用debug和release密钥进行了尝试)
这是我的身材。格雷德尔:
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);
错误消息中提到的
aud
属性是用于身份验证的JWT(JSON Web令牌)中的访问群体,它标识您要连接的项目。因此,错误消息表示您正在连接与令牌不匹配的项目。我面临同样的问题。电子邮件验证工作正常。这是我的日志输出07-22 17:43:14.347 2812-2812/com.solvek.smartlamp E/packet:读取此处不支持的空字符串。07-22 17:43:24.137 2812-2812/com.solvek.smartlamp I/Timeline:Timeline:Activity\u idle id:android.os。BinderProxy@21886b1d时间:13161789