Oidc-spaIDC SPA

The Openid Connect client library you've been waiting for.

Let's integrate Keycloak with your web application.

Oidc-spa is a generic OpenID Connect client for Single Page Applications (e.g: Vite projects).
It is a library that you use to redirect your users to an authentication server like Keycloak when they click on your Sign-in button.
It's an alternative to the soon to be deprecated keycloak-js library.

Accessible to all skill levels

In the documentation, we do not assume that you are an expert in OIDC or Keycloak. We offer comprehensive guidance from start to finish, you can join our Discord server if you need help.

React Integration

Oidc-spa is not tied to any particular UI framework. However, we provide a React API and example projects demonstrating integration withTanstack orReact Router.


Expect best in class type safety: Enhanced API response types based on usage context. Optional Zod integration for validating the user profile from the JWT.

Incredibly easy to set up

There is no need for creating special /login /logout routes. Just a login() function to call when you want to redirect your user to the login/registration pages.

Helps you debug

If somethings is wrong in your configuration, wether it's a CORS issue, a security header blocking the authentication, or a bad Keycloak setting, oidc-spa will tell you precisely what's wrong and how to fix it.

Auto logout

Effortless setup forautomatic logout after a specified period of inactivity. Are you still there? You will be automatically logged out in 10...9...

Sovereign and Open source Identity Management

Oidc-spa like Keycloakify is an initiative aimed at delivering a comprehensive solution for open source, self-hostable user identity management. The objective is to offer both user and development experiences comparable to those of platforms likeAuth0,Okta,Clerk, etc.
While Keycloak offers extensive capabilities, its complexity can make it challenging to use and integrate. Oidc-spa and Keycloakify seek to simplify Keycloak, ensuring that opting for an open source solution does not compromise user experience or developer productivity.

We're not selling anything

Free and Open source software

It's an MIT licensed  open source project.
You can use it in your commercial projects without any restrictions.

Batteries included

We got you covered

Oidc-spa provides simples solution all common usecases.


Zone 2 is backing the project. We recommend their services.

Keycloak Consulting Services

Your partner in Keycloak deployment, configuration, and extension development for optimized identity management solutions.

Feature 01