Firebase登录:GoogleSignIn onActivityResult()返回RESULT_CANCELED,结果错误12500 [英] Firebase Sign In: GoogleSignIn onActivityResult() returns RESULT_CANCELED with Result error 12500
问题描述
好吧,我知道这个问题已经被问过多次了,但是由于某种原因,这个错误一直在发生,这是这种情况:
Ok, i am aware that this question has been asked multiple times, but for some reason this error keeps happening, this is the scenario:
-
创建的PROD firebase项目,在运作良好的Android项目(Android项目路径:app/google-services.json)中插入了google-services.json,其中包含:
Created PROD firebase project, inserted google-services.json within Android project (Android project path: app/google-services.json) that is working perfectly, contains:
- 两个SHA1密钥-来自.android/debug.keystore(目前为)和自定义发布密钥库(基于这些密钥的2个Oauth2 Android客户端ID)
- 用于Google登录的Oauth2 Web客户端ID-我已将其放入Firebase控制台/身份验证/提供程序/Google登录/Web SDK配置中
- Firebase项目ID为com.companyname.projectname格式
然后我创建了DEV firebase项目(app/debug/google-services.json),并完成了以下操作:
Then I created DEV firebase project (app/debug/google-services.json) and i've done the following:
- 创建自定义调试密钥库,导出SHA1并将其添加到Firebase项目中(该密钥库用于签名调试)
- 在
build.gradle
内,已将此调试密钥库分配给调试构建类型,并且可以正常工作-正在使用该密钥库对其进行签名 - 创建了新的Oauth2 Web客户端ID,并以与PROD for Google登录提供商相同的方式将其插入
- 此项目的Firebase项目ID为com.companyname.projectname-dev(在构建类型debug中添加了应用程序后缀)
- Created custom debug keystore, exported SHA1 and added It into Firebase project (That keystore is used to sign debug)
- Within
build.gradle
, assigned this debug keystore to debug build type and that is working - it is being signed using that keystore - Created new Oauth2 Web client id and inserted it in the same way as in PROD for Google Sign in provider
- Firebase Project ID for this project is com.companyname.projectname-dev (added application suffix within build type debug)
当我使用调试构建类型运行应用程序时,会发生以下情况:
When I run app with debug build type, this is what happens:
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
GoogleSignInClient googleSignInClient = GoogleSignIn.getClient(this, gso);
这很好- requestIdToken 是DEV Firebase项目中的Oauth2 Web客户端ID
This is good - requestIdToken is the Oauth2 Web Client ID from DEV Firebase project
BuildConfig.APPLICATION_ID
返回DEV applicationId(带-dev后缀)
BuildConfig.APPLICATION_ID
returns DEV applicationId (with -dev suffix)
但是当我转到onActivityResult()时,我从该问题的标题中得到了- RESULT_CANCELED + 12500结果错误
But then when I go to onActivityResult(), i get what i get from the title of this question - RESULT_CANCELED + 12500 result error
有人遇到过同样的问题吗?
Has anyone had the same issue?
对于一个比较混乱的问题,我深表歉意,如有必要,我会添加更多信息.
My apologies for rather chaotic question, i will add more info if necessary.
注意:我曾尝试在DEV项目中使用.android/debug.keystore SHA1,但存在与上述相同的问题.
Note: I have tried using the .android/debug.keystore SHA1 within DEV project, but I had the same issue as the above.
推荐答案
我首先尝试的内容:
我想通过此错误ApiException:12500很长时间.我尝试了一切:
What I tried first :
I want through this error ApiException: 12500 for a long time. I tried everthing :
- 删除我的debugkeystore,重新创建一个
- 在Firebase控制台上添加支持电子邮件
- 更改插件的版本
- 在我的设备上更新google
但是当我浏览stackoverflow时,我找到了一个解决方案:
But when I was browsing stackoverflow, I found a solution :
我转到了此页面( https://console.developers.google.com/apis/凭据) 不要忘记在列表中选择您的项目(左上方).然后进入"Oauth同意屏幕"
I went to this page (https://console.developers.google.com/apis/credentials) Do not forget to select your project on the list (top left). Then go on "Oauth consent screen"
我几乎填写了所有字段:应用程序徽标,电子邮件支持,应用程序主页链接,应用程序隐私策略链接(以及project.firebaseapp.com);并且我保存了.
I filled almost all the fields : the application logo, the email support, the application homepage link, application privacy policy link (with the project.firebaseapp.com); and I saved.
现在可以使用了,我可以登录.
Now it's working, I can login.
希望这会有所帮助
感谢Pranjal Gupta的回答: Google登录错误12500
Thanks to answer of Pranjal Gupta : Google Sign In error 12500
这篇关于Firebase登录:GoogleSignIn onActivityResult()返回RESULT_CANCELED,结果错误12500的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!