com.google.android.gms.auth.GoogleAuthException:为gettoken(来源不明)异常 [英] com.google.android.gms.auth.GoogleAuthException: getToken(Unknown Source) exception
问题描述
在我的Android应用程序,我试图让谷歌令牌来验证我的谷歌应用程序引擎的后端服务器。但是,我总是得到此异常:
In my Android application, I am trying to get google token to verify at my google app engine backend server. But I always get this exception :
com.google.android.gms.auth.GoogleAuthException: getToken(Unknown Source) exception
我的code:
My code :
private Account mAccount = AccountManager.get(this).getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE)[0];
private static final String SCOPE = "audience:server:client_id:" +Constants.WED_CLIENT_ID;
String token = GoogleAuthUtil.getToken(LoginActivity.this, mAccount.name, SCOPE);
我曾在提出#1每个解决方案。
I have tried every solution proposed in Stackoverflow.
推荐答案
经过2天的研究,我发现,当时您注册您的Android应用程序在谷歌云控制台 - >项目 - > API和权威性,它要求你指纹,以便产生的ClientID,不知怎么我的指纹是错误的(我不小心添加〜$
此CMD前密钥工具-exportcert -alias androiddebugkey -keystore〜 /.android/debug.keystore | OpenSSL的SHA1
),并且由于这一点,有人给了我错了指纹,是的根本原因:
After 2 days of research I found that at the time you register your android application in Google Cloud Console -> your project - > API and auth, it ask you for fingerprint in order to generate ClientID and somehow my fingerprint was wrong (I accidentally added ~$
before this cmd keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1
) and due to this it was giving me wrong finger print and was the root cause of:
com.google.android.gms.auth.GoogleAuthException: getToken(Unknown Source) exception.
这篇关于com.google.android.gms.auth.GoogleAuthException:为gettoken(来源不明)异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!