'webclient 400 Bad Request from POST
I use a web client for authentication to an API but I get this error. knowing that the URI is correct . the error : org.springframework.web.reactive.function.client.WebClientResponseException$BadRequest: 400 Bad Request from POST with root cause
```WebClient client = WebClient.create();
JSONObject credentials = new JSONObject();
credentials.put("login", "admin");
credentials.put("password", "admin");
String response = client.post()
.uri(new URI("http://localhost:8080/rest/auth/v1/token:create"))
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
.bodyValue(credentials)
.retrieve()
.bodyToMono(String.class)
.block();```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
