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_credentialsclient_id=test-clientclient_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
相关产品推荐
相关产品推荐

