Keycloak and Spring Oauth2 - CORS issue

Viewed 104

I try to connect my Keycloak auth server (SpringBoot) at localhost:8082 with my React frontend at localhost:3000 and my login request works fine only when I type it diectly to browser, it doesn't redirect me to login page from my frontend, because I get

CORS header 'Access-Control-Allow-Origin' missing

How does one enable CORS in SpringBoot keycloak? I've put

"redirectUris" : [ "http://localhost:8082/new-client/login/oauth2/code/custom",
      "http://localhost:3000",
      "http://localhost:3000/success"],
"webOrigins" : [ "+" ],

in my realm.json, but it doesn't solve the issue. I know there is this "enable-cors" : true property, but how to use it if my keycloak config resides in application.properties? Or do I have to switch to json config? Thanks in advance.

RESOLVED by this post keycloak CORS filter spring boot

0 Answers
Related