2015-10-16 87 views
1

我一年前下載了Android Starter應用程序,並在其上寫下了我的代碼。 Google認證過去一直很好,直到很久以前。
我啓用了Google,Facebook和Yahoo認證。
我在我的網站上實現了Google登錄工作正常的Gitkit v3。Gitkit Android:gms.StatusHelper電線狀態:INVALID_AUDIENCE狀態:null

現在,在我的Android應用程序中,自定義用戶標識身份驗證工作正常,但Google身份驗證不是。

當選擇Gmail ID時,什麼也沒有發生:onSignIn()onSignInFailed()都被觸發。

在過去的一年中,這部分中的任何服務器端代碼更改都不是向後兼容嗎?

===================================

在logcat中,會產生以下異常

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 

==========================

更新:當選擇一個Gmail的ID爲登錄可見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

我能夠解決問題,至少部分。問題在於我提供了名稱爲"package"的名稱,其中包名是在Google Developer Console上要求輸入密鑰的。我應該提供"build.gradle"中提到的"applicationId"。就我而言,兩者都不同。由於在所有文檔中,都提到了提供軟件包名稱,我感到困惑。

做出更改後,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文件的清單中所使用的最後 包,是 您的應用程序被稱爲您的設備上,並在谷歌Play商店的包,是「應用程序ID」 。在您的源代碼中使用到 的包涉及您的R類,並解決任何相對活動/服務 註冊,繼續稱爲「包」。