我正在使用google plus api使用oauth2基礎結構登錄我的用戶。我想使用後端身份驗證服務。我一步一步按照本指南https://developers.google.com/identity/sign-in/android/backend-auth。但是每次我打電話使用受衆羣體時引發GoogleAuthException:server:client_id:<SEERVER_CLIENT_ID>
scope1 = "audience:server:client_id:" + SERVER_CLIENT_ID; GoogleAuthUtil.getToken(context, account, scope1);
它拋出上述異常。我嘗試了所有由stackoverflow以及其他博客提供的解決方案,似乎沒有任何改變。
有沒有辦法來更深入地驗證這個問題的原因。我的意思是在「谷歌開發者控制檯」或android方面的一些調試工具,以更具體地瞭解發生了什麼事情。
logcat的輸出:
V/GLSActivity(3383): AuthDelegateWrapperCreated with selected intent: Intent { cmp=com.google.android.gms/.auth.DefaultAuthDelegateService } V/AuthAccountOperation(18778): offline access is not requested; requesting access token I/GLSUser(3383): [GLSUser] getTokenFromCache: [account: <ELLIDED:-15230>, callingPkg: com.clanpid.mobile.restaurant.app, service: oauth2:https://www.googleapis.com/auth/plus.login] I/GLSUser(3383): [GLSUser] getTokenFromGoogle [account: <ELLIDED:-15230>, callingPkg: com.clanpid.mobile.restaurant.app, service: oauth2:https://www.googleapis.com/auth/plus.login I/GLSUser(3383): [GLSUser] getAuthtoken(<ELLIDED:-15230>, oauth2:https://www.googleapis.com/auth/plus.login) -> status: null) I/GLSUser(3383): [GLSUser] Extracting token using key: Auth W/GLSUser(3383): [GLSUser] Permission for com.clanpid.mobile.restaurant.app to access oauth2:https://www.googleapis.com/auth/plus.login will be managed remotely. V/AuthAccountOperation(18778): access token request successful I/GLSUser(3383): [GLSUser] getTokenFromCache: [account: <ELLIDED:-15230>, callingPkg: com.clanpid.mobile.restaurant.app, service: oauth2:https://www.googleapis.com/auth/plus.login] D/UserAccessTokenFetcher(25646): [email protected] I/GLSUser(3383): [GLSUser] getTokenFromCache: [account: <ELLIDED:-15230>, callingPkg: com.clanpid.mobile.restaurant.app, service: audience:server:client_id:1074993820719-dlcpq2f2ev9pnlmlghclteakv50ivft1.apps.googleusercontent.com] I/GLSUser(3383): [GLSUser] getTokenFromGoogle [account: <ELLIDED:-15230>, callingPkg: com.clanpid.mobile.restaurant.app, service: audience:server:client_id:1074993820719-dlcpq2f2ev9pnlmlghclteakv50ivft1.apps.googleusercontent.com W/GLSActivity(3383): gms.StatusHelper Status from wire: INVALID_AUDIENCE status: null I/GLSUser(3383): [GLSUser] getAuthtoken(<ELLIDED:-15230>, audience:server:client_id:1074993820719-dlcpq2f2ev9pnlmlghclteakv50ivft1.apps.googleusercontent.com) -> status: UNKNOWN) I/GLSUser(3383): [GLSUser] Extracting token using key: Auth W/GLSActivity(3383): gms.StatusHelper Status from wire: INVALID_AUDIENCE status: null W/System.err(25646): com.google.android.gms.auth.GoogleAuthException: Unknown
感謝大衛,對不起,回來這麼晚。自從我轉移到Amazon Cognito SSO以來,我沒有嘗試您的建議。使用Cognito時,我的服務器應用程序會造成沉重的負擔。無論如何,我所遇到的錯誤似乎與我所擁有的項目太舊有關,然後谷歌在GAE中做了一些改變,出於某種原因,他們搞砸了這個舊項目。開始一個新項目效果很好。 –