首页 > 解决方案 > 刷新 keycloak 访问令牌给出 ssl3_get_record:wrong version number

问题描述

我正在尝试使用来自 keycloak 的刷新令牌。我可以通过 curl 使用原始访问令牌并从我的应用程序接收数据。但是当它尝试使用我的刷新令牌获取新的访问令牌时,

$ curl -v --data "grant_type=refresh_token&client_id=bikes-app&refresh_token=$RTOKEN" https://mint191:8080/auth/realms/SpringBootKeycloak/protocol/openid-connect/token
*   Trying 127.0.1.1...
* TCP_NODELAY set
* Connected to mint191 (127.0.1.1) port 8080 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* error:1408F10B:SSL routines:ssl3_get_record:wrong version number
* Closing connection 0
curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number

$ echo $RTOKEN eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUI......A8dS93p6bzqg

我得到了原始令牌

结果=curl -s -X POST -H 'Content-Type: application/x-www-form-urlencoded' -d 'username=user1&grant_type=password&client_id=bikes-app&password=123456' http://mint191:8080/auth/realms/SpringBootKeycloak/protocol/openid-connect/token

然后获取令牌并刷新令牌变量。然后我可以使用令牌从应用程序访问数据。

补充一点,我不在代理后面(这似乎是stackoverflow上其他示例中的原因)。如果我可以获得访问和刷新令牌,那么我应该能够使用刷新令牌。

标签: curloauth-2.0keycloak

解决方案


我的错误。

我在 https 而不是 http 上要求刷新令牌。


推荐阅读