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.
相关产品推荐
相关产品推荐

