twitter - Twitter OAuth2 令牌撤销返回 401 错误,提示“不允许客户端应用程序使此令牌无效”。
问题描述
我可以获得 OAuth2 令牌,但无法撤销它。
重现错误:
let token_url = "https://api.twitter.com/oauth2/token";
let revoke_url = "https://api.twitter.com/oauth2/invalidate_token"
let auth = {
username: CLIENT_API_KEY,
password: CLIENT_API_SECRET_KEY
}
axios.post(token_url, "grant_type=client_credentials", { auth })
.then( response => {
let access_token = response.data["access_token"]
axios.post(revoke_url, `access_token=${access_token}`, { auth })
.then( response => {
console.log("REVOKE SUCCESS")
console.log(response)
})
.catch( e=> {
console.log("Failed to revoke")
console.log(e.response.data)
})
})
然后我得到
Failed to revoke
{ errors:
[ { code: 348,
message:
'Client application is not permitted to to invalidate this token.' } ] }
尝试谷歌搜索,但代码 348 和消息中没有任何内容。http 错误代码是401 (unauthorized)
.
我永远无法撤销我的 OAuth2 令牌。帮助。
解决方案
推荐阅读
- html - 在 Powershell 中从 txt 正确导出为 html
- java - 在 JOOQ 中映射相同类型的连接表
- c# - UltraWinGrid 使用数据表滚动到底部
- javascript - 如何在不手动单击扩展按钮的情况下自动化 chrome 扩展以在网站启动时运行
- java - 字符串之间的区别!和 kotlin 中的字符串
- c++ - 如何在 C++ curl 代码中设置授权不记名标头?我得到的授权不足,即使它在命令行上工作
- c# - 使用 Selenium C# 和 AutoIT 脚本处理 Windows 弹出窗口时面临的问题
- java - 如何将整个班级称为 Main Activity?
- angular - 在Angular 2+中创建值后立即导航编辑窗口
- alexa - Alexa 技能请求中的多个权限解决方案PerAuthority