node.js - 如何撤销 Google OAuth 提供的 token ? NodeJS

标签 node.js oauth-2.0 google-api-nodejs-client

我已使用 oauth2 从 NodeJS 应用程序连接到 google plus,但如何撤销 token /断开连接?我在 NodeJS 的文档中找不到任何内容。

最佳答案

您可以使用 revokeToken 撤销 token 来自 google.auth.OAuth2 对象的函数:

oauth2Client.revokeToken(token, function(err, body) {

});

您还有revokeCredentials清除凭证对象并撤销其中的访问 token 的函数:

oauth2Client.revokeCredentials(function(err, body) {

});

关于node.js - 如何撤销 Google OAuth 提供的 token ? NodeJS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44781211/

相关文章:

javascript - 如何将字符串作为文件上传到 Google 云端硬盘?

nexpect 模块中的 Node.js 等待函数不起作用

node.js - 如何配置 Puppeteer 以正确呈现外部 JS 页面?仅适用于本地主机 URL

java - 使用 Oltu 传递给 OAuthTokenRequest 时无法使用 @Context HttpServletRequest 检索发布数据

android - 未经联系人许可,GoogleAccountCredential.setSelectedAccountName(String) 无法在 Android 6.0 上运行

authentication - access_type = Online 什么时候合适? :OAuth2 - Google API

node.js - 使用 Node.js 上传时设置 YouTube 视频标题(googleapi 模块 v1.0)

mysql - NodeJS + MySql : Is this code correct for multiple select queries since they are asyncronous

javascript - 错误 Nodejs 中函数缺少返回类型

node.js - 无法使用gmail api Node js发送邮件