Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 解码GoogleAuthUtil.getToken(Android)_Java_Android_Google Play Services_Token_Decode - Fatal编程技术网

Java 解码GoogleAuthUtil.getToken(Android)

Java 解码GoogleAuthUtil.getToken(Android),java,android,google-play-services,token,decode,Java,Android,Google Play Services,Token,Decode,在我的代码中,我获取的google+id令牌如下: Bundle bundle = new Bundle(); bundle.putString(GoogleAuthUtil.KEY_REQUEST_ACTIONS, "http://schemas.google.com/AddActivity http://schemas.google.com/BuyActivity");

在我的代码中,我获取的google+id令牌如下:

Bundle bundle = new Bundle();
                    bundle.putString(GoogleAuthUtil.KEY_REQUEST_ACTIONS,
                            "http://schemas.google.com/AddActivity http://schemas.google.com/BuyActivity");
                    String token = GoogleAuthUtil.getToken(context,
                          Plus.AccountApi.getAccountName(mGoogleApiClient), scope,bundle);
它返回一个76个字符的序列,而我应该接收如下内容:

{
  'issued_to': 'xxxxxx.apps.googleusercontent.com',
  'user_id': 'yyyyyy',
  'expires_in': 3457,
  'access_type': 'online',
  'audience': 'xxxxxx.apps.googleusercontent.com',
  'scope': 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile',
  'email': 'xxxxx@yyyyy.com',
  'verified_email': True
}
还返回此错误消息:

{
 "error_description": "Invalid Value"
}
你知道我做错了什么吗?
我必须解码吗?如果是这样的话,如何解释?

76个字符表示它是Base64密钥,这是您将其解码为字节数组的方式(如回答所示):

byte[]data=Base64.decode(Base64,Base64.DEFAULT);
字符串文本=新字符串(数据,“UTF-8”)