Search code examples
oauthcalendaroauth-2.0google-calendar-apigoogle-oauth

Is it possible to authenticate server to server with Google Calendar API?


So I read the following on the Authorizing Requests to the Google Calendar API page written by Google folks.

Your application must use OAuth 2.0 to authorize requests. No other authorization protocols are supported. If your application uses Google Sign-In, some aspects of authorization are handled for you.

My knowledge of OAuth 2.0 is limited so I'm not sure if that means that I cannot get a one-time auth token for a user?

I'm building an app that will need to CRUD events for a user in the background based on other stuff. So I can't have the user authenticate over and over again. Is there a way around here?

If not, is there an Google Calendar alternative that has a dependable API that I could use?


Solution

  • When the user authenticates your application you are given an Access token (good for one hour) and a refresh token. You should save the refresh token, when ever you need to access the users data you can take the refresh token and ask Google to give you a new access token. It is the access token which gives you access to there account.

    I wrote a tutorial that tries to explain Oauth2 how to set it up and how it works. Google Developer console Oauth2