Google API OAuth2

Viewed 33

I am trying to build an ETL integration with google sheets. On the front end i was able to promt user to grant access to their drive and sheets but what i would like to do is to somehow be able to then later run a scheduled sync from cloud funtions in Firebase to access their sheets and sync the data to another endpoint. How can i use use the permissions grant to do this on the backend without having to authenticate again? I cannot find any articles about this on the web or in the gapi documentation.

1 Answers

If you specify the offline_access scope in the authorization request, you should receive a refresh token from the authorization server, if the user grants you that permission.

With that refresh token, you can get a new access token from the authorization server, without the involvement of the user.

Note that the refresh token typically has an expiration date too.

Related