Keycloak缺少表单参数:grant

编程入门 行业动态 更新时间:2024-10-09 05:18:47
本文介绍了Keycloak缺少表单参数:grant_type的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在本地计算机上运行了独立的keycloak.

I have keycloak standalone running on my local machine.

我创建了一个名为"spring-test"的新领域,然后创建了一个名为"login-app"的新客户端

I created new realm called 'spring-test', then new client called 'login-app'

根据其余文档:

POST: localhost:8080/auth/realms/spring-test/protocol/openid-connect/token { "client_id": "login-app", "username": "user123", "password": "pass123", "grant_type": "password" }

应该给我jwt令牌,但是我收到了带有响应的错误请求

should give me the jwt token but I get bad request with response

{ "error": "invalid_request", "error_description": "Missing form parameter: grant_type" }

我假设我的配置中缺少某些东西.

I am assuming that something is missing in my configuration.

我正在使用json正文,但应该为application/x-www-form-urlencoded: 以下身体起作用:

I was using json body but it should be application/x-www-form-urlencoded: the following body works:

token_type_hint:access_token&token:{token}&client_id:{client_id}&client_secret:{client_secret}

推荐答案

您应在POST请求中发送数据,并将标头值设置为application/x-www-form-urlencoded,而不是json.

You should send your data in a POST request with Content-Type header value set to application/x-www-form-urlencoded, not json.

更多推荐

Keycloak缺少表单参数:grant

本文发布于:2023-11-26 23:38:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1635679.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表单   参数   Keycloak   grant

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!