【发布时间】:2020-11-21 13:56:06
【问题描述】:
我想使用 Spring Cloud 为 OAuth2 实现令牌刷新。
我可以通过使用此有效负载向/oauth/token 发送请求来创建令牌:
curl --location --request POST 'http://localhost:8080/engine/oauth/token' \
--header 'Authorization: Basic YWRtaW46cXdlcnR5' \
--form 'username=admin' \
--form 'password=qwerty' \
--form 'grant_type=password' \
--form 'scope=read'
但对于刷新令牌,使用相同的路径 /oauth/token。我还需要将用户名和密码发送到标题'Authorization: Basic YWRtaW46cXdlcnR5'我没有它们。我可以使用带有此有效负载的刷新令牌创建一个新令牌:
curl --location --request POST 'http://localhost:8080/engine/oauth/token' \
--header 'Authorization: Basic YWRtaW46cXdlcnR5' \
--form 'grant_type=refresh_token' \
--form 'scope=read' \
--form 'refresh_token=....'
你知道如何解决这个问题吗?
Github code
【问题讨论】:
标签: oauth-2.0 spring-cloud spring-security-oauth2 spring-oauth2