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

Keycloak容器部署后获取Bearer Token报错求助

Keycloak Client Credentials模式Token获取报错解决指引
  • 修正请求URL:Keycloak 17+版本移除了旧版的/auth前缀,正确Token端点为 http://<你的Keycloak地址>:<端口>/realms/test-realm/protocol/openid-connect/token
  • 确认客户端配置:在test-client的设置中,开启Client authentication选项,在Credentials页签设置客户端密钥(如Client Secret类型)
  • 检查请求参数:POST请求需包含以下必填项(Content-Type设为application/x-www-form-urlencoded):
    • grant_type=client_credentials
    • client_id=test-client
    • client_secret=<你的客户端密钥>
  • 快速测试命令:
    curl -X POST http://localhost:8080/realms/test-realm/protocol/openid-connect/token \
      -H "Content-Type: application/x-www-form-urlencoded" \
      -d "grant_type=client_credentials" \
      -d "client_id=test-client" \
      -d "client_secret=xxxxxx"
    

内容的提问来源于stack exchange,提问作者Yura

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.08 21:50:24