4

I'm trying to make a Java app (stand alone not web based) that connects to Google calendar but im having issues getting past the OAuth stage. I have looked over every part of the Google API i can see.

The newest version i can find is at https://developers.google.com/google-apps/calendar/instantiate

I have downloaded the 2 sets of JAR files they say to (google-api-services-calendar-v3-rev3-1.5.0-beta and gdata-samples.java-1.46.0) and imported the required libraries and dependencies. This gives me deprication errors for about half the classes and some methods (mainly new Calendar(httpTransport, accessProtectedResource, jsonFactory);) dont work at all.

Has anyone got a basic example of getting an OAuth token and accessing the Google Calendar API? Am i looking at this the wrong way or am i using an out of date copy of the api?

Is gdata still in use or has it been replaced? Thanks Adrian

HK1
  • 11,941
  • 14
  • 64
  • 99
Darc
  • 745
  • 10
  • 26
  • GData is still in use but is considered deprecated. Somewhere I read that it will be considered obsolete sometime in 2014. Take a look at this post and see if it answers your question. It's written for C# so maybe it will be too different: http://stackoverflow.com/questions/8899000/c-sharp-google-calendar-v3-2-legged-authentication-fails – HK1 Apr 08 '12 at 03:26

2 Answers2

1

You need to first get oauth working then use oauth to call some google api for example calendar.

Start from google oauth 1 for installed app or google oauth 2 for installed app or search for "google oauth installed app". Scrib is a good oauth lib for Java.

Ali Shakiba
  • 20,549
  • 18
  • 61
  • 88
  • Thanks for your answer, i ended up using the raw http calls and just handling the results and it appears to be working fine. – Darc Apr 09 '12 at 06:13
0

I have no idea why the code is listed wrong in the documentation. The line below worked for me.

Calendar(httpTransport, jsonFactory, accessProtectedResource);
Tequila
  • 844
  • 9
  • 19