我正在尝试访问日历详细信息,但我似乎收到了无效凭据错误。我访问以下网址:“ https://www.googleapis.com/calendar/v3/calendars/ {google_id}/events”
像这样 :
DefaultHttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet(url_);
get.addHeader("Authorization","OAuth" + auth_token);
try {
HttpResponse response = client.execute(get);
我应该放什么额外的标题?我正在从一个 android 应用程序访问它。如果重要的话,我会通过一个以 AccountManager.newChooseAccountIntent() 开始的活动来获得我的 auth_token。
我得到以下json:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}