google / clasp

đŸ”— Command Line Apps Script Projects
https://developers.google.com/apps-script/guides/clasp
Apache License 2.0
4.56k stars 427 forks source link

Clasp push drops oauthScopes #756

Open kwiesmueller opened 4 years ago

kwiesmueller commented 4 years ago

I got a Gmail Add-on that worked before. Currently, some users produced weird Missing access token for authorization errors that neither I nor other users could reproduce. After further investigation, I discovered that I gave the Add-on access to "https://www.googleapis.com/auth/gmail.readonly" (as defined in the appscript.json), but impacted users do not have this permission.

Expected Behavior

Our appscript.json contains this section:

"oauthScopes": [
    "https://www.googleapis.com/auth/gmail.addons.execute",
    "https://www.googleapis.com/auth/gmail.addons.current.message.metadata",
    "https://www.googleapis.com/auth/gmail.readonly",
    "https://www.googleapis.com/auth/userinfo.email",
    "https://www.googleapis.com/auth/script.external_request"
],

When executing a clasp push or clasp push --force the result being sent seems to be:

"oauthScopes": [
    "https://www.googleapis.com/auth/gmail.addons.execute",
    "https://www.googleapis.com/auth/gmail.addons.current.message.metadata",

"https://www.googleapis.com/auth/userinfo.email",
    "https://www.googleapis.com/auth/script.external_request"
],

This is taken from the script.google.com Version History.

Actual Behavior

I expect that the scopes be present as defined in my config (as i think to remember it previously was).

Steps to Reproduce the Problem

  1. Send a config with the above oauthScopes section to a project.
  2. Inspect the manifest online.

Specifications

kwiesmueller commented 4 years ago

FTR: When i update my manifest locally, i get asked if i want to overwrite it online. Pressing yes does still drop the field.

kwiesmueller commented 4 years ago

If I edit the manifest online and the do a clasp pull, i get a valid appscript.json into ./dist

PopGoesTheWza commented 4 years ago

@kwiesmueller can you please put up a sample repos on GitHub for me to investigate?