0

I have an Spring Boot 3 app. I use Keycloak and Open Api 3. Open Api (swagger) works fine for get methods, but not for post. For POST methods I get a 403. I see that I can configure OpenApi so that I can send manually an access token, but I find it very ugly.

Is there really no way to make open api send a request with the credentials towards Keycloak, get the token from response and add it in the header when a request to an endpoint is made?

Octavia
  • 198
  • 1
  • 13

1 Answers1

0

I found the issue. In spring boot 3, http.csrf(Customizer.withDefaults()) actually means that csrf protection is enabled. As Keycloak uses an access token, we don't need csrf protection. So I just disabled it with http.csrf().disable(). Now everything works.

Octavia
  • 198
  • 1
  • 13