Get a 401 when producing a message
Closed this issue · 1 comments
fdelbrayelle commented
Overview of the issue
Motivation for or Use Case
Reproduce the error
- Create a new test project:
mkdir test && cd test && jhipster
- Create a new entity
Foo
with a String fieldbar
:jhipster entity Foo
- Use the Kafka module to generate a consumer and a producer for the Foo entity:
yo jhipster-kafka
- Run the Kafka broker:
docker-compose -f src/main/docker/kafka.yml up
- Run the application:
./mvnw
- Get a JWT token by authenticating:
token=`curl -X POST localhost:8080/api/authenticate -d '{ "username": "admin", "password": "admin" }' -H "Content-Type: application/json"|jq '.id_token'`
-
Call the producer through the Kafka REST resource with bad fields for Foo:
curl -X POST localhost:8080/api/foos/kafka -H "Authorization: Bearer $token" -d '{ "foo": "foo" }' -H 'Content-Type: application/json'
-
💥 :
{
"type" : "https://www.jhipster.tech/problem/problem-with-message",
"title" : "Unauthorized",
"status" : 401,
"detail" : "Full authentication is required to access this resource",
"path" : "/api/foos/kafka",
"message" : "error.http.401"
}%
Related issues
Suggest a Fix
JHipster Version(s)
JHipster configuration
Entity configuration(s) entityName.json
files generated in the .jhipster
directory
Browsers and Operating System
- Checking this box is mandatory (this is just to show you read everything)
fdelbrayelle commented
Was missing -r
option in jq
command 👎