简体   繁体   English

使用 Google Apps 脚本从 G Suite 管理控制台中删除 web 应用程序

[英]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.

相关问题 是否可以将 Google Apps Script Web App 发布到 G Suite Marketplace? - Is it possible to publish a Google Apps Script Web App to G Suite Marketplace? 有G Suite / Google Apps API吗? - Is there a G Suite/Google Apps API? 如何将 Google Apps Script Web 应用程序发布到 G-Suite Marketplace? - How to publish a Google Apps Script web app to the G-Suite Marketplace? 使用 Google Apps 脚本发送的 G Suite 电子邮件未发送“邮件已阻止” - G Suite Emails Sent with Google Apps Script Are Not Delivered "Message Blocked" 事件保存/更新时的 g-suite Google 日历应用程序脚本 - g-suite Google Calender Apps script On Event Save/Update 如何获取使用 Google Apps 脚本的 G Suite 用户列表? - How to get a list of G Suite users which are using Google Apps Script? 在 G-Suite Enterprise 的 Google Apps 脚本中显示 Google Picker,无需访问 GCP - Show Google Picker in a Google Apps Script in G-Suite Enterprise without access to GCP 无法使用Google Apps脚本从网站读取信息 - Fail to read information from a web site using Google Apps Script 从 Google Apps 脚本中的日期中删除时间戳 - Remove timestamp from date in Google Apps Script Google Apps脚本从驱动器中删除文件夹 - Google Apps Script Remove Folder From Drive
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM