0
votes

I'm trying to access calendar details but I seem to get a invalid credentials error. I access the following url: "https://www.googleapis.com/calendar/v3/calendars/{google_id}/events"

like this :

DefaultHttpClient client = new DefaultHttpClient();

HttpGet get = new HttpGet(url_); 
get.addHeader("Authorization","OAuth" + auth_token);
try {
    HttpResponse response = client.execute(get);

What extra headers should I put there? I'm accessing it from an android application. If it matters I got my auth_token by an activity started with AccountManager.newChooseAccountIntent().

I'm getting the following json:

{
  "error": {
   "errors": [
    {
     "domain": "global",
     "reason": "authError",
     "message": "Invalid Credentials",
     "locationType": "header",
     "location": "Authorization"
    }
   ],
   "code": 401,
   "message": "Invalid Credentials"
  }
 }
1

1 Answers

0
votes

There should be a space between OAuth and the token in your header.