Enable Google API OAuth Scope

[亡魂溺海] 提交于 2021-01-01 03:49:11

问题


For one of the application created using Google Apps Script, some scopes are automatically added as follows in my app:

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

https://www.googleapis.com/auth/script.external_request

https://www.googleapis.com/auth/script.send_mail

https://www.googleapis.com/auth/spreadsheets

I've followed all the steps for OAuth Client Verification according to this documentation. But still, my verification process is pending and support team said that I need to add https://www.googleapis.com/auth/drive.file scope to my project.

Anybody know how to add/enable https://www.googleapis.com/auth/drive.file scope in the existing project.


回答1:


When you authenticate your application you should request the additional scope

  1. Open the script project in the Apps Script editor.
  2. In the menu, select File > Project properties.
  3. Select the Scopes tab.
  4. Review the scopes your script currently requires and determine what changes need to be made. Click Cancel when finished.
  5. If the manifest file appsscript.json isn't visible in the left nav bar, select the View > Show manifest file menu item.
  6. Select the appsscript.json file in the left nav to open it.
  7. Locate the top-level field labeled oauthScopes. If it is not present, you can add it.
  8. The oauthScopes field specifies an array of strings.

example

{
  ...
  "oauthScopes": [
    " https://www.googleapis.com/auth/drive.file",
    "https://www.googleapis.com/auth/userinfo.email"
  ],
}

check the documentation here



来源:https://stackoverflow.com/questions/47330954/enable-google-api-oauth-scope

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!