我正在尝试访问日历详细信息,但似乎收到了一个无效凭据错误。我访问以下网址:"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);
我应该在那里多放些什么标题?我正在从安卓应用程序访问它。如果重要的话,我是通过AccountManager.newChooseAccountIntent().启动的活动获得授权的
我得到以下json:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
OAuth和头中的令牌之间应该有一个空格。