enuchi / React-Google-Apps-Script

This is your boilerplate project for developing React apps inside Google Sheets, Docs, Forms and Slides projects. It's perfect for personal projects and for publishing complex add-ons in the Google Workspace Marketplace.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creative ideas to enhance performance? EG getting Access Token into React App

nicolasiscoding opened this issue · comments

Hello, I am writing an add-on for Google Docs and I noticed my getAccessToken() server-side function takes too long and could impact UX moving between states. Right now, my app is structured in the following flow:

  1. Modal which redirects to our Login Page using Auth Code Flow with PKCE (using https://github.com/googleworkspace/apps-script-oauth2)

  2. Storing the Access Token in PropertiesService.getUserProperties()

  3. Closing the Modal and opening a Sidebar (main app)

  4. Making another Google App Scripts Server Call to retrieve the Access Token from the Properties Service.

I'm trying to find a happy medium to minimize the amount of slow-running Google App Script calls to make sense like using fetch on the React App where needed.

Trying to understand the flow a bit more. Is the idea that if you log in in the modal you can also be logged in when opening the sidebar?