我正在尝试向https://{identity-server}:9443/oauth2/token
发送请求。并且该请求被重定向到位置:https://{identity-server}:9443/carbon/admin/login.jsp
。我使用的版本是IS5.7.0,作为集群设置部署在Kubernetes上。
您在请求中缺少授权标头。这就是您被重定向到登录页面的原因。
尝试提供类似的授权标头
Authorization: Basic [Base64encode(Client-ID>:<ClientSecret>)]
最终请求应类似于此
curl -X POST
https://localhost:9443/oauth2/token
-H 'Authorization: Basic Zkd2ZlhiQ05VeUFmd2ltQW9HSWYycXZDakdFYTpFb1NOWDdHNFQ2NGZjcVFyZTVIX2NPR01CS2Nh'
-H 'Content-Type: application/x-www-form-urlencoded'
-d 'username=admin&password=admin&grant_type=password&scope=bearer'