简体   繁体   English

getToken google +登录Android GoogleAuthException:未知

[英]getToken google+ login Android GoogleAuthException: Unknown

This only happens when I call getToken(param, param, param, param). 这仅在我调用getToken(param,param,param,param)时发生。

I am not certain what I am doing wrong. 我不确定自己在做什么错。 Here is my code leading up to and including getToken: 这是我的代码,导致并包括getToken:

Bundle bundle = new Bundle();
                    bundle.putString(GoogleAuthUtil.KEY_REQUEST_ACTIONS,
                             "http://schemas.google.com/AddActivity http://schemas.google.com/BuyActivity");
                    bundle.putString(GoogleAuthUtil.KEY_REQUEST_VISIBLE_ACTIVITIES, "http://schemas.google.com/AddActivity http://schemas.google.com/BuyActivity");

                    String clientId = "xxxxxxxxxxxxx.apps.googleusercontent.com";

                    if(MyApplication.PRODUCTION){
                        clientId = "xxxxxxxxxxxxx.apps.googleusercontent.com";
                    } else {
                        clientId = "xxxxxxxxxxxxx.apps.googleusercontent.com";
                    }

                    String scopes = "oauth2:server:client_id:" + clientId + ":api_scope:oauth2:https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email";
                    LogUtils.log("scopes string: " + scopes);
                    accessToken = GoogleAuthUtil.getToken(ctx, mPlusClient.getAccountName(), scopes, bundle);


                  LogUtils.log("access token: " + accessToken);

In return I get an Exception: 作为回报,我得到一个异常:

01-31 17:38:28.093: I/test(7124): GoogleAuthException: com.google.android.gms.auth.GoogleAuthException: Unknown

turned out to be the Id being used on someone elses account too. 原来也是别人帐户上使用的ID。

Works now. 现在可以使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM