First, let me explain what I am trying to do, as this is a two part question.
I am building a JAX-RS service that internally authenticates with a Google account via
I am an Android Mobile App Developer. I am making an application using Google Calendar API (OAuth 2.0). I also faced this same error. But now, I have resolved the error. I am writing the scenario and the solution for it.
The url of getting the Calendar Event for the particular calendar (Mobile App API):
https://www.googleapis.com/calendar/v3/calendars/en.indian%23holiday%40group.v.calendar.google.com/events?access_token=ya29.AHES6ZQyP3iDZM8PF-7ZqZE8oKmWAgUX55sPGPTjGbM5A
In this url, we have to add the calendarId. The format of the url is;
https://www.googleapis.com/calendar/v3/calendars//events
I was not encoding the calendarId before adding to the url. I encoded the calendarId and then made the Http request. All went fine then.
final String accessToken=dataStore.getAccessToken();
List params = new LinkedList();
params.add(new BasicNameValuePair("access_token", accessToken));
String paramString = URLEncodedUtils.format(params, "utf-8");
final String url = String.format(AuthConstants.CALENDAR_EVENTS_URI,URLEncoder.encode(calendarId))+"?"+ paramString;
Now the calendar events are returned in the JSON.