[keycloak-user] Cors

Fabio Ebner fabio.ebner at lumera.com.br
Mon Oct 15 20:04:43 EDT 2018


I tryng to get a token with a JS Client. so I configu my client just like
the image, and this is my code (Axios) to try to get the token:


this.axios.post('
http://localhost:9090/auth/realms/Lumera/protocol/openid-connect/token',  {
          username: this.email,
          password: this.senha,
          grant_type: 'password',
          client_id: 'central-api'
        },
        {
          headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
          },
        },
        ).then((response) => {
         console.log('ok');
        },
        ).catch((error) => {

          console.log('erro');
        });

but I got the error:

Failed to load
http://localhost:9090/auth/realms/Lumera/protocol/openid-connect/token: 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.


[image: Screen Shot 2018-10-15 at 21.00.51.png]



If i use postman to get a token works fine. so the Web Origins should works
in this case?


tks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2018-10-15 at 21.00.51.png
Type: image/png
Size: 75143 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/keycloak-user/attachments/20181015/b6acc831/attachment-0001.png 


More information about the keycloak-user mailing list