我正在尝试使用 pkce 和 authorization_code 流从 keycloak 获取令牌,但没有成功。
请求参数(来自邮递员):
curl -X POST \
http://keycloak-ar.uat.com/auth/realms/myrealm/protocol/openid-connect/token \
-H 'Accept: */*' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Authorization: Basic YWJyYWFvLxF1ZWlyb3o6MTIz' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Length: 172' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Host: keycloak-ar.uat.com' \
-d 'grant_type=authorization_code&client_id=spring-boot-app&username=apiuser&client_secret=cd78e82a-e86a-4bf3-a3d7-7c01cec49396&code=qjrzSW9gMiUgpUvqgEPE4_-8swvyCtfOVvg55o5S_es'
密钥斗篷日志:
22:50:01,962 WARN [org.keycloak.events] (default task-146) type=CODE_TO_TOKEN_ERROR, realmId=myrealm, clientId=spring-boot-app, userId=null, ipAddress=10.128.2.1, error=invalid_code, grant_type=authorization_code, client_auth_method=client-secret