1

I've built an add-on for google spreadsheets using google apps script and I can't figure out why it asks for Drive permissions. The Drive API is not enabled, I'm not using DriveApp class anywhere in the project and the driveapp scope is also not defined anywhere, but it shows up in the OAuth Authorization Screen and makes the app to be unverified: enter image description here enter image description here

These are the scopes from the Project Properties: enter image description here

Scopes defined in the appscript.json file:

"oauthScopes": [
    "https://www.googleapis.com/auth/analytics.edit",
    "https://www.googleapis.com/auth/analytics.readonly",
    "https://www.googleapis.com/auth/script.container.ui",
    "https://www.googleapis.com/auth/script.external_request",
    "https://www.googleapis.com/auth/script.scriptapp",
    "https://www.googleapis.com/auth/script.send_mail",
    "https://www.googleapis.com/auth/spreadsheets",
    "https://www.googleapis.com/auth/userinfo.email"
  ]

And finally, scopes authorized in the Google Cloud Platform, OAuth consent screen: enter image description here

Valip
  • 4,440
  • 19
  • 79
  • 150
  • Google SpreadSheets is part of Drive. This link shows the required OAuth scopes: https://developers.google.com/sheets/api/guides/authorizing – jwilleke Dec 13 '19 at 09:29
  • 1
    Did you had a look at [this Stackoverflow](https://stackoverflow.com/questions/48179449/allow-this-application-to-run-when-you-are-not-present-in-google-apps-script/48200656)? You might use the DriveApp in a comment. If that's not the case, try to remove scopes one by one and you'll see which one ask for Drive permissions. I would start with `https://www.googleapis.com/auth/script.storage` which might store scripts in the user's Google Drive, thus asking for Drive permissions – Frenchcooc Dec 13 '19 at 09:33
  • @jwilleke does it means that the `driveapp` scope is not required to be verified in the OAuth consent screen? – Valip Dec 13 '19 at 09:38
  • Can you provide your code to see where the call to Drive might come from? – ziganotschka Dec 13 '19 at 09:52
  • @ziganotschka I'm not using Drive anywhere and the Drive API is not enabled – Valip Dec 13 '19 at 10:01
  • If there's a api call that requires drive permissions, it might be added. Could you list all the apis enabled for this project? I'll start by blaming the analytics api.... Disable the api and see? – TheMaster Dec 13 '19 at 10:21
  • It uses only Google Analytics API. I think it's the `https://www.googleapis.com/auth/spreadsheets` scope that requires access to Drive – Valip Dec 13 '19 at 11:25
  • I would try removing `" . . . ://www.googleapis.com/auth/analytics.edit" and see if that makes any difference. – Alan Wells Dec 13 '19 at 14:26
  • If you do not want to share your code, I recommend you to troubleshoot by reducing it to very basic and gradually adding more code, to see which line triggers the request for drive scopes. – ziganotschka Dec 13 '19 at 20:55
  • 1
    @ziganotschka the code is huge and it would be a pain to reduce it. I will try to remove the scopes one by one and see it I can figure out the problem this way. – Valip Dec 16 '19 at 10:07

2 Answers2

1

It seems that I had the driveapp scope added in the G Suite Marketplace configuration and the OAuth screen don't ask anymore for the Drive permissions after removing that scope. The "Unverified" app message also don't show up anymore.

Valip
  • 4,440
  • 19
  • 79
  • 150
0

As written in the documentation of Google Sheets, you need few Drives authorizations to use the API if you do not work with public data.

https://www.googleapis.com/auth/drive.readonly

https://www.googleapis.com/auth/drive.file

https://www.googleapis.com/auth/drive (Request this scope only when it is strictly necessary.)

Community
  • 1
  • 1
ThisIsMyName
  • 887
  • 7
  • 14
  • Then the Drive permission is not the one making the app to be unverified, there must be something else – Valip Dec 13 '19 at 09:44