You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular开发中如何撤销ORDS生成的OAuth AccessToken?

解决方案

你的请求返回MethodNotAllowed错误,核心原因是端点路径错误——ORDS的OAuth Token撤销端点为/oauth/revoke,而非你使用的/oauth/token/revoke。此外,建议添加token_type_hint参数明确要撤销的Token类型(可选但推荐),帮助ORDS高效处理请求。

以下是两个可行的撤销命令:

方式1:使用手动Base64认证头

curl -k -v -X POST \
  -d "token=<myToken>&token_type_hint=access_token" \
  -H "Authorization: Basic <base64 string>" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  http://mydomain/ords/myuser/oauth/revoke

方式2:使用--user参数自动生成认证头(更简便)

curl -k -v -X POST \
  -d "token=<myToken>&token_type_hint=access_token" \
  --user <client_id>:<client_secret> \
  -H "Content-Type: application/x-www-form-urlencoded" \
  http://mydomain/ords/myuser/oauth/revoke

说明:

  • 将<myToken>替换为你需要撤销的AccessToken值
  • <base64 string>是client_id:client_secret的Base64编码结果
  • token_type_hint可选值为access_token或refresh_token,根据你要撤销的Token类型选择

内容的提问来源于stack exchange,提问作者En D.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.17 06:20:02