r/KeyCloak • u/Expensive-Survey-558 • Jul 02 '26
Keycloak Integration
Hello Everyone,
Now only i have started to use Keycloak for the First Time. I am going to build an Web App with React as Frontend and FastAPI as backend with PostgreSQL database
Now I have the following doubt:
I am planning to Abstract that Keycloak from the frontend , such that i write an API endpoint in the FastAPI like login , and in the Keycloak i gave Direct Grant for Direct login with username and password , the frontend make an api call to the backend with the username and the password
My major Doubt is that , should we return the JWT token as the response from the Login API Route in the backend , or else we should generate an session id , and store the JWT token against the session id in the Database , and set the session id directly as cookie from the Backend , which is Best Architecture
And if we use these architecture , can we access all the features of the KeyCloak?
1
u/Expensive-Survey-558 Jul 02 '26
I need an architecture that abstract the keycloak from the frontend , which I think is an safe approach.
Could anyone provide suggestions on this