ascobol
ascobol

Reputation: 7706

permanent programmatic access to my own google calendar

I need to access to my own google calendar. The oauth2 stuff is more likely designed to allow an access to someone else's calendar. Is there a way to get permanent credentials to my own calendar?

edit:

To clarify I'm programming a web site that need to display calendar events in a custom way, not possible by simply including an iframe. The web backend is in Python and I need that backend to get a list of events from my calendar, do a bit of filtering and display those events. The list of events must be automatically synchronized with the calendar (but I'm planning to use caching to reduce the number of requests to the google API).

I managed to get an oath2 token but it has an expiration date ("expires_in": 3600). There is a refresh option for tokens but there seems to be limits in the number of refresh allowed (see https://developers.google.com/accounts/docs/OAuth2 point 4. Refresh the token). Since the purpose of oauth2 is mainly to allow access to other users calendars, I wonder if there is another authentication scheme allowing a permanent api access to my own calendar.

Upvotes: 5

Views: 1135

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599856

Your premise is wrong: OAuth2 is very much meant for programmatic access to your own calendar, as much as to anyone else's. Indeed, I use it for exactly this purpose.

You have misunderstood what that link is telling you. It's not saying you can only refresh a limited number of times; it's saying that you can only have a certain number of refresh tokens at once. Normally, that's not a problem, because you store the access token in your database, and the code takes care of refreshing it when it expires.

The Python client library's Credentials and Storage objects take care of this all for you: all you do is provide the original refresh token, along with the client id and secret, and it automatically refreshes when necessary.

Upvotes: 4

Related Questions