I am working on a project I inherited that adds some functionality to Google Docs through a workspace add-on written in Google Script. The add-on makes API requests to a standalone web application. The web app is required to have access to some of the users' Google data (e.g. Gmail), sometimes while the user is offline.
The way that I'm giving my server access to Google data is to use apps-script-oauth2 to kick off an authentication workflow using https://accounts.google.com/o/oauth2/auth as the base, and configure it with all of the Google-related scopes that the server will need. (I know this library says it for "non-Google" OAuth, but this was built before I started on the project, and I'm unaware of a better way to do it). Once I get an id_token and a refresh_token, I send it to our server and store the refresh token encrypted in a database.
When testing this works fine, the add-on starts off installed but then asks our server whether the current user exists; if they don't, the user just kicks off the AUTH flow.
When listing in the marketplace, however, the user is asked to confirm all of the scopes they need twice: once when installing the add-on, and then again when creating the service needed to communicate with our server. Even more confounding/alarming is that the second OAuth confirmation screen specifically mentions that certain scopes were already granted to the same app.
My question is basically what is the correct way to deal with this. I realize I can get the OAuth token already granted using the ScriptApp class, but if this doesn't have a refresh token associated with it then giving our server access later is problematic.