我在一年前下载了Android初学者应用程序,并在其上编写了我的代码。直到一段时间以前,Google身份验证才能正常运行 我启用了Google,Facebook和Yahoo身份验证 我已经在我的网站上实现了Gitkit v3,目前谷歌登录工作正常。
目前,在我的Android应用中,自定义用户ID身份验证工作正常,但Google身份验证却没有。
选择Gmail ID时,没有任何结果:onSignIn()
和onSignInFailed()
都未被触发。
在过去的一年中,这部分是否实现了任何服务器端代码更改,但这些代码没有向后兼容?
===================================
在logcat中,当为登录选择了Gmail ID时,会出现以下异常:
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: Unrecoverable auth exception: Unknown
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: com.google.android.gms.auth.GoogleAuthException: Unknown
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at com.google.identitytoolkit.idp.google.GoogleIdpClient$1.call(GoogleIdpClient.java:131)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at com.google.identitytoolkit.idp.google.GoogleIdpClient$1.call(GoogleIdpClient.java:125)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at com.google.identitytoolkit.executor.ProgressRequestExecutor$2.doInBackground(ProgressRequestExecutor.java:84)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at com.google.identitytoolkit.executor.ProgressRequestExecutor$2.doInBackground(ProgressRequestExecutor.java:71)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at android.os.AsyncTask$2.call(AsyncTask.java:295)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
10-16 21:29:40.928 6453-14199/com.application.my_app E/GooglePlusIdpClient: at java.lang.Thread.run(Thread.java:818)
10-16 21:29:40.933 6453-6480/com.application.my_app E/Surface: getSlotFromBufferLocked: unknown buffer: 0x9f1fb160
==========================
更新1
我尝试使用Android的新客户端ID并在我的Python端点代码中使用它。这没有用。
==========================
更新2
我创建了一个新的Client ID for Web application
并在端点python文件(如WEB_CLIENT_ID
)和AndroidManifest.xml(作为identitytoolkit.server_client_id
的值)中使用它。以下异常仍然存在:
10-18 09:43:38.000 12063-15754/? W/GLSActivity: gms.StatusHelper Status from wire: INVALID_AUDIENCE status: null
10-18 09:43:38.000 12063-15754/? I/GLSUser: [GLSUser] getAuthtoken(<ELLIDED:-2092860235>, audience:server:client_id:My_NEW_Client_Id__For_Web_Application.apps.googleusercontent.com) -> status: UNKNOWN)
10-18 09:43:38.000 12063-15754/? I/GLSUser: [GLSUser] Extracting token using key: Auth
10-18 09:43:38.000 12063-15754/? W/GLSActivity: gms.StatusHelper Status from wire: INVALID_AUDIENCE status: null
10-18 09:43:38.050 1914-3643/? I/ActivityManager: Start proc 2421:com.google.android.partnersetup/u0a11 for broadcast com.google.android.partnersetup/.RlzPingBroadcastReceiver
10-18 09:43:38.117 12147-12257/? W/Icing: GetUsageReports fallback to slow seek
10-18 09:43:38.120 1914-2954/? I/ActivityManager: Killing 32316:com.android.defcontainer/u0a4 (adj 15): empty #17
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: Unrecoverable auth exception: Unknown
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: com.google.android.gms.auth.GoogleAuthException: Unknown
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at com.google.identitytoolkit.idp.google.GoogleIdpClient$1.call(GoogleIdpClient.java:131)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at com.google.identitytoolkit.idp.google.GoogleIdpClient$1.call(GoogleIdpClient.java:125)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at com.google.identitytoolkit.executor.ProgressRequestExecutor$2.doInBackground(ProgressRequestExecutor.java:84)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at com.google.identitytoolkit.executor.ProgressRequestExecutor$2.doInBackground(ProgressRequestExecutor.java:71)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at android.os.AsyncTask$2.call(AsyncTask.java:295)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
10-18 09:43:38.163 1233-2364/com.application.my_app E/GooglePlusIdpClient: at java.lang.Thread.run(Thread.java:818)
10-18 09:43:38.178 1233-1272/com.application.my_app E/Surface: getSlotFromBufferLocked: unknown buffer: 0x9f355b50
请帮忙。
答案 0 :(得分:0)
我能够解决问题,至少部分解决了。问题是我提供了"package"
名称,要求在Google Developer Console上为密钥提供包名称。我应该提供"applicationId"
中提到的"build.gradle"
。就我而言,两者都不同。因为在所有文档中,提到包名称,我感到困惑。
进行更改后,Google身份验证正常运行。我正在研究仍然无效的Facebook身份验证。
我已迁移到最新的Gitkit库,我发现新的android库中缺少以下功能:
我想弄清楚他们的解决方法:
IdToken idToken = client.getSavedIdToken();
Account account = client.getSavedAccount();
以下链接将解释此部分
http://tools.android.com/tech-docs/new-build-system/applicationid-vs-packagename
以上链接的相关摘录
因此,我们已将包名称的两个用法分离:最终 在您构建的.apk的清单中使用的包,并且是包 您的应用在您的设备和Google Play商店中称为 &#34;应用程序ID&#34;。您的源代码中使用的包 参考您的R类,并解决任何相关活动/服务 注册,继续被称为&#34;包&#34;。