Apps Script to Chat API - sudden Access blocked: https://www.googleapis.com/auth/chat.import

I have a simple apps script project that creates a Space in G-Chat and later will add some users to it.  Very simple and it worked many times until this morning when I started getting an error: 

Access blocked: Authorization Error

Some requested scopes cannot be shown: [https://www.googleapis.com/auth/chat.import]

I have been working on resolving this all day with no luck. I have stripped the complexity back to this:

 

function createSpace(projectName) {
      var space = Chat.Spaces.setup({
          space: {
            spaceType: 'SPACE',
            displayName: projectName
          }
      });
      Logger.log(space.name);
}
I have checked the Google Cloud Console:
  • Google Chat API is enabled and Configured
  • using OAuth 2.0 Client IDs
  • OAuth consent screen is sup for Internal

I tried manually adding the scope (https://www.googleapis.com/auth/chat.import), but it just gives a red "?" circle. I have also added all Google Chat API scopes explicitly to try and get this resolved.

I appreciate any ideas you may have.

Solved Solved
0 3 156
1 ACCEPTED SOLUTION

In the script manifest, manually set the scopes but *exclude* chat.import (but make sure you have either https://www.googleapis.com/auth/chat.spaces or https://www.googleapis.com/auth/chat.spaces.create)

The chat.import scope can only be used in very particular use cases and is disallowed on the consent screen. But as a side-effect of how Apps Scripts automatically determines scopes it's incorrectly included.



View solution in original post

3 REPLIES 3

In the script manifest, manually set the scopes but *exclude* chat.import (but make sure you have either https://www.googleapis.com/auth/chat.spaces or https://www.googleapis.com/auth/chat.spaces.create)

The chat.import scope can only be used in very particular use cases and is disallowed on the consent screen. But as a side-effect of how Apps Scripts automatically determines scopes it's incorrectly included.



And just like that, I'm back up and running.  Thank you so much for the quick reply! Do you know why that scope was suddenly included when it wasn't utilized by the code?

This issue is being tracked in https://issuetracker.google.com/337335902.

Top Labels in this Space
Top Solution Authors