[英]Remove the web apps from the G Suite Admin Console by using Google Apps Script
Suppose I have list of web apps in G Suite Admin console.假设我在 G Suite 管理控制台中有 web 应用程序列表。 I want to remove the web apps from the list.
我想从列表中删除 web 应用程序。 I know i can remove my web app from admin console one by one.
我知道我可以从管理控制台中一一删除我的 web 应用程序。
But I want to remove (or revoke) the web apps using Google Apps Script.但我想使用 Google Apps 脚本删除(或撤销) web 应用程序。 Can we do it?
我们能做到吗?
Will this code do the trick?这段代码能解决问题吗?
var res = UrlFetchApp.fetch(https://accounts.google.com/o/oauth2/revoke?token=" + ScriptApp.getOAuthToken());
Logger.log(res.getResponseCode());
The code that is included in the question will not do "the trick".问题中包含的代码不会“解决问题”。
You need to use the G Suite Admin SDK Directory API .您需要使用G Suite 管理员 SDK 目录 API 。 Fortunately, Google Apps Script has it as an Advanced Service -> Admin SDK Directory Service .
幸运的是,Google Apps 脚本将其作为高级服务 -> Admin SDK Directory Service 。
At this time it's not possible to uninstall / revoke domain-wide installed apps but it's possible to do this on a user by user basis.目前无法卸载/撤销在域范围内安装的应用程序,但可以逐个用户执行此操作。
By using this service, first you should get a list of the domain users, then get the tokens.通过使用此服务,您首先应该获取域用户列表,然后获取令牌。 From each token you should get the clientId, then using the user primary email address and the clientId you could delete the token so the web app will not be able to access the user data and do things on behalf the users anymore but bear in mind that they could authorize these apps again unless you disable this permission on the G Suite Admin Console.
您应该从每个令牌中获取 clientId,然后使用用户主 email 地址和 clientId 您可以删除令牌,因此 web 应用程序将无法访问用户数据并代表用户执行操作,但请记住他们可以再次授权这些应用,除非您在 G Suite 管理控制台上禁用此权限。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.