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

泄露秘密 提交于 2021-01-28 05:13:31

问题


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:


回答1:


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


来源:https://stackoverflow.com/questions/60582226/g-suite-marketplace-add-on-oauth-error-400-invalid-request-account-restricted

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