[keycloak-dev] Issue with CORS on Keycloak (RH-SSO)

Joao Paulo Ramos jramos at redhat.com
Fri Nov 30 14:52:26 EST 2018


Hi guys,

Sorry if it's not the correct place to make this question (please guide me
to the correct place).

I'm facing some problems with CORS when using rh-sso 7.1.
I'm using the following environment:
- JBoss EAP 7.1 with Resteasy in the backend ->
localhost:8080/accountmovement/api
- ReactJS in the frontend -> localhost:3000
- RH-SSO (7.1 and 7.2) -> localhost:8180

The JBoss EAP is using the Wildfly/EAP Adapter from Red Hat, with the
configurations made on the standalone.xml file as a subsystem:

      <subsystem xmlns="urn:jboss:domain:keycloak:1.1">
            <secure-deployment name="accountmovement.war">
                <realm>demo</realm>
                <resource>accountmovement-backend</resource>

<use-resource-role-mappings>true</use-resource-role-mappings>
                <public-client>true</public-client>
                <auth-server-url>http://localhost:8180/auth
</auth-server-url>
                <ssl-required>EXTERNAL</ssl-required>
                <enable-cors>true</enable-cors>
            </secure-deployment>
       </subsystem>

I Already enabled the Web Origins to " * " in the RH-SSO Admin console for
both of the clients I'm using.

The error I receive is the following:

""
Failed to load
http://localhost:8080/accountmovement/api/accounts?_=1543522008489:
Redirect from '
http://localhost:8080/accountmovement/api/accounts?_=1543522008489' to '
http://localhost:8180/auth/realms/demo/protocol/openid-connect/auth?response_type=code&client_id=accountmovement-backend&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Faccountmovement%2Fapi%2Faccounts?_%3D1543522008489&state=ce5ee16c-f5f7-4a9e-affd-3316c4fad78f&login=true&scope=openid'
has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is
present on the requested resource. Origin 'http://localhost:3000' is
therefore not allowed access.
""

Do you have any idea for what can I do?

If you need more information just let me know!

Thank you,

JOÃO PAULO RAMOS

BUSINESS FINANCE - DATA SCIENCE INTERN

Red Hat Brasil

jramos at redhat.com   M: +55-11-96505-6159
<https://red.ht/sig>


More information about the keycloak-dev mailing list