首页 > 解决方案 > 生成 Keycloak 离线令牌

问题描述

我是 Keycloak 身份和用户管理的新手。我主要是在寻找一种生成离线令牌的方法。

目前我有授权 URL、访问令牌请求和刷新令牌请求为了生成离线令牌,我们需要添加额外的参数作为scope=offline_access 我不知道为什么在我的情况下它没有生成,因为我已经验证了不记名令牌jwt.io 的“典型”不是“离线”。

访问令牌请求是

curl \  
 -d "client_id=<my-client-id>" -d "client_secret=<client-secret>" \  
 -d "username=<user>" -d "password=<pass>" \
 -d "grant_type=password" \
 -d "scope=openid info offline_access" \   
 https://localhost:8080/auth/realms/demo/protocol/openid-connect/token | jq

Method: POST
URL: https://keycloak.example.com/auth/realms/myrealm/protocol/openid-connect/token
Body type: x-www-form-urlencoded
Form fields:    
client_id : <my-client-name>
grant_type : refresh_token
refresh_token: <my-refresh-token>

请建议

标签: keycloakspring-security-oauth2bearer-token

解决方案


推荐阅读