Authorization for Google ToDo List (AuthToken, secid)

I am trying to access a Google todo feed with this URL:

https://www.google.com/calendar/tdl?secid=<SECID>&tdl={%22action_list%22%3A[{%22action_type%22%3A%22get_all%22%2C%22action_id%22%3A%221%22%2C%22list_id%22%3A%2215052708471047222911%3A0%3A0%22%2C%22get_deleted%22%3Afalse}]%2C%22client_version%22%3A-1}

If I open this in my browser with the correct secid, it will show me what I want.

Now the question arises: how can I get a program key (in particular, in a java program)? I have access to authToken (from CalendarService), but I don’t know how to use it to authorize my access to the above URL.

I tried using the url http://google.com/accounts/ServiceLogin , but I did not find any examples.

Any help please?

+6
authentication google-calendar google-oauth2
source share
2 answers

From what I read secid , is the session id derived from browser cookies. While your business uses Java, which implies a server application. If so, you want to abandon the idea of ​​fully using secid .

Instead, you want to check out the Google OAuth2 Documentation . If you use Java, you will most likely be interested in the OAuth flow of the web server . Pay particular attention to sequence diagrams.

Key steps are:

1) Get the authorization code from Google OAuth with the consent of the user. To do this, you redirect the user to Google with the appropriate scope. View a list of calendar areas for your case. After the user agrees, Google will redirect the authorization code back to you.

2) Call Google OAuth with the authorization code and your application credentials to exchange the access token.

3) Call the Google Calendar API using an access token.

And if you use the Google Java client, as suggested by @ChaosPredictor, most likely some of the steps are already wrapped in the Java client (and your code will be much simpler).

+1
source share

I think here is a good place to start.

0
source share

All Articles