google-apps-scriptgoogle-cloud-platformoauthgoogle-docsgoogle-apps-script-addon

Adding Google API OAuth scopes for an Add On project


I'm having an inordinate amount of trouble fixing my OAuth screen for my published Google Docs add on. Specifically, I've gone into the project to retrieve the scopes that the project accesses, and it gives me this list:

3 OAuth Scopes required by the script:
https://www.googleapis.com/auth/documents
https://www.googleapis.com/auth/script.container.ui
https://www.googleapis.com/auth/script.external_request

When I enter Google Cloud Console and attempt to edit the project and add these APIs, I simply can't. I keep typing in the latter two into the scope box and they just do not show up. I have a sneaking suspicion that this is why the OAuth still won't work... TIA.


Solution

  • UPDATE: 7/6/20 The user interface for the G Suite Marketplace SDK in the Cloud Platform has recently changed for G Suite accounts. But for free / consumer accounts, it looks like it's hasn't been updated.

    The information below is NOT for the new user interface. If the new user interface fixes this problem, then obviously this answer will become obsolete.

    END UPDATE

    Unfortunately, the user interface for adding scopes often fails when adding a new scope. When publishing an add-on, you need to enter your scopes in two different places:

    1. The OAuth Consent page
    2. The GSuite Marketplace SDK Configuration page

    See the following image for adding scopes to the OAuth Consent page. Note that at the bottom, there is a link for adding a scope manually. Click that, and paste in your scope, then click the "Add" button.

    Add Scope to OAuth Consent