Search code examples
oauthgoogle-apigoogle-oauthgoogle-calendar-api

How long does the connection to Google Calendar API lasts?


I am building a website where the users can schedule a meeting between two persons. In this meeting, there will also be a third person that will ALWAYS be the same and always be there.

My idea was, on the admin panel, make this third user logout and when there is a request for a meeting in the app, make a calendar event / Google Meet where the third account will invite the two users.

This action will be made automatically and these events will happen on the span of many months. I wanted to know how often the user will have to connect. Can he connect just once and then the token for the requests is valid forever or will the third attendee have to login periodically in order to keep the token "fresh"?

Thanks!


Solution

  • The way oauth works is that when authorized you are granted an access token which will give you access to the users data for one hour. If when authorizing the user you request "offline" access as well then you will be given a refresh token.

    The refresh token does not expire for the most part, and can be used to request a new access token at anytime. There by refreshing your access as needed.

    Get a refresh token for this user and then just refresh the access as needed.