v-ladynev / keycloak-nodejs-example

A simply step by step Keycloak, MySQL and Node.js integration tutorial. There are some docker examples as well.
291 stars 102 forks source link

Replace access denied response #12

Closed Enado95 closed 3 years ago

Enado95 commented 3 years ago

Is there a way to return a different response from the 403 Access denied? I would want to return my own error object.

v-ladynev commented 3 years ago

@Enado95 I think you have to configure keycloak-connect for that https://www.keycloak.org/docs/latest/securing_apps/index.html#_nodejs_adapter

You can start from here https://github.com/v-ladynev/keycloak-nodejs-example/blob/master/lib/keyCloakService.js#L41

Enado95 commented 3 years ago

Works!! Much appreciated.