0
所有,的Android getauthutil爲gettoken不返回JWT
我寫一個Android應用程序,我想使用Google+爲我的客戶經理。
我跟着excellent article here,我被提示登錄到Google +,並且我的事件得到了令牌。
問題是,令牌似乎不是JWT(我知道這是因爲只有2個虛線部分的名稱而不是3,並且當我將「token」傳遞給同一個引用的java文章中,我得到一個異常表明一切都沒有很好地與令牌:
com.google.api.client.repackaged.com.google.common.base.Preconditions.checkArgument(Preconditions.java:76)
at com.google.api.client.util.Preconditions.checkArgument(Preconditions.java:37)
at com.google.api.client.json.webtoken.JsonWebSignature$Parser.parse(JsonWebSignature.java:473)
at com.google.api.client.googleapis.auth.oauth2.GoogleIdToken.parse(GoogleIdToken.java:57)
at Checker.check(Checker.java:34)
的代碼如下所示: -
String scope = "oauth2:server:client_id:";
scope += scope_; // my client id in the web section
scope += ":api_scope:";
String googleauth;
googleauth ="https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/plus.login";
scope+=googleauth;
try
{
String token = GoogleAuthUtil.getToken(act_, s_account, scope);
....
應用程序也要求驗證,我允許它(和呼叫getToken,就像你應該的那樣)
但令牌似乎是無法使用的,其約束是愚蠢的,但至今我什麼也看不見。
問候