Hi,

 

as the subject said I got an error while sending a request to my keycloak server.

I configured the following things:

1.       External Keycloak server (runs on localhost:8180)

a.       Add realm

b.      Add client/application

c.       Add roles

d.      Add user + roles for this user

e.      Add Url to Web Origins (http://localhost:8080)

2.       Wildfly 8 Server (runs on localhost:8080)

a.       Add keycloak adapter for wilrdfly 8

b.      Add Security domain

c.       Add subsystem for keycloak (generated from keycloak admin console)

3.       My Application

a.       Keycloak.json (generated from Keycloak admin console | “enable-cors” is set to true)

b.      Downloaded keycloak.js and added it to jsp/html pages

c.       Defined security-constraints and security-roles in web.xml

 

I got the problem while trying to login to my application. Keycloak accepts my username and password and forwards me to the first site of my application.

There I am using the keycloak.js to “login” and handle the different roles but within this workflow I got the following errors:

 

1.       “XMLHttpRequest cannot load ‘http://localhost:8180/auth/realms/TOMAMappingConfigurationService/tokens/access/codes’. No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Origin ‘http://localhost:8080’ is therefore not allowed access. The response had HTTP status code 400. ”

2.       “XMLHttpRequest cannot load ‘http://localhost:8180/auth/realms/TOMAMappingConfigurationService/account’. No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Origin ‘http://localhost:8080’ is therefore not allowed access. The response had HTTP status code 403. ”

 

I hope you can help me.

Kind regards,

Lars