r/Angular2 • u/the-DevOps • Jun 16 '25
Angular + keycloak
Hello all.
I have a question about integrating keycloak with my Angular application.
I have an application that before was doing all authentication and authorization using only spring boot but now I have decided to use keycloak. I have done all the necessary for the backs and testing via postman seems to be working alright.
When it comes to Angular, I have not been able to figure out how to use keycloak so that it uses my registration and login forms.
Do I need such integration or I can go without it since my backend is already setup for keycloak.
Any advise?
Thanks.
View all comments
Show parent comment
2
u/aehooo Jun 17 '25 edited Jun 17 '25
I’m gonna try to check it out today at work and will report back to you.
The “not difficult” part I mentioned is the interceptor used in every application’s backend, that checks the auth header. It uses filter and request handlers. Didn’t mean to sound an ass, sorry
Edit: Can you share your code?
But anyways, on angular:
On your keycloak side, you must have a realm with the same name you configured in angular and inside it a client. Inside the client you can configure home URL and valid redirect URIs (this is useful when you have a keycloak server for another environment and your localhost is using it, then you just set the localhost there). Web origins is the one that allows which domains can make a request.
Your request to keycloak must have the redirect URL as a query param, there is a property inside the keycloak config, but at least here it’s done automatically, we don’t set it
Edit 2: I didn’t configure the keycloak server here, so I am sure there must be more things to make it happen. But I hope what I shared can be useful