[keycloak-user] How to only protect specific paths (SPA)

Mehdi Mehdi mehdi_cit at hotmail.com
Mon Oct 9 09:54:13 EDT 2017


Hello everyone and thank you for sharing keycloak with the community.

I'm trying to use keycloak on my SPA (single page application with javascript in both front & back ends).

I only want to password protect specific paths and not all paths. The problem is that once I do require login

keycloak.init( {onLoad: 'login-required'})...
on some "sensitive path" all the other paths become protected. I suspected that would happen because I did not find a function to suspend "requiring a login".

Indeed, I did test this by going to the keycloak admin page and logged out the user (who was by then on a public/not-protected path). On my SPA the user got kikked out asking her for a password through keycloak even though she was on a 'public path'.

In short, is there a way to instruct keycloak not to require a login.

BTW, I'm only using keycloak on the front end right now.. Need to make it work before also using it on my API (back end).

Thank you in advance for your feedback.


More information about the keycloak-user mailing list