简体   繁体   中英

G Suite Marketplace Add-on OAuth: Error 400: invalid_request Account restricted

Has any Google Add-on developers received this error when a user trys to install:

Error 400: invalid_request Account Restricted

This only happens to some users even if the app is whitelisted in the domain admin console of the user. Our app is listed on the G Suite Marketplace and is approved and verified, the OAuth consent screen works for most users. The user is able to see the consent screen but as soon as they click Accept they get this error:

在此处输入图片说明

I had the same issue with one of my G Suit accounts. In my case, there was an issue with one of the scopes that the Google Spreadsheet script has been using. To be more specific https://www.googleapis.com/auth/classroom.topics.readonly . This scope is required if you want to work with topics in Google Classroom. I am pretty sure there was some kind of account restriction but unfortunately, I was not able to find the respective setting in Google Admin Console. I have contacted G Suite Support as someone suggested here but they were not able to help me. Eventually, I had to remove this scope from my script and it worked fine but you may have issues with other scopes and here is how you can find out which one is causing the problem.

Steps

  1. Find an account that consistently has this issue
  2. Create new google spreadsheet
  3. Go to the Tools -> Script Editor
  4. Click View -> Show Manifest file. This will create a manifest file called appsscript.json
  5. Then start adding scopes from your list of scopes one by one to the oauthScopes field in a json file. If it's not there then add it
  6. Click Run -> Run function -> your function

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM