fdelbrayelle/generator-jhipster-kafka

Get a 401 when producing a message

Closed this issue · 1 comments

Overview of the issue
Motivation for or Use Case
Reproduce the error
  1. Create a new test project: mkdir test && cd test && jhipster
  2. Create a new entity Foo with a String field bar: jhipster entity Foo
  3. Use the Kafka module to generate a consumer and a producer for the Foo entity: yo jhipster-kafka
  4. Run the Kafka broker: docker-compose -f src/main/docker/kafka.yml up
  5. Run the application: ./mvnw
  6. 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'`
  1. 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'

  2. 💥 :

{
  "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)

Was missing -r option in jq command 👎