oidc-spa
v5.6.1
Published
Openidconnect client for Single Page Applications
Downloads
14,368
Readme
An Open ID Connect client tailored for Single Page Applications, particularly suitable for Vite projects.
This library is intended for scenarios such as integrating your application with Keycloak.
In straightforward terms, this library is ideal for those seeking to enable user login/registration in their web application. When used in conjunction with Keycloak (for example), it enables you to offer a modern and secure authentication experience with minimal coding effort. This includes options for signing in via Google, X, GitHub, or other social media platforms. We provide comprehensive guidance from beginning to end.
- 🎓 Accessible to all skill levels; no need to be an OIDC expert. And we are here to help on Discord.
- 🛠️ Easy to set up; eliminates the need for creating special
/login
/logout
routes. - 💬 Helpful debug message telling you what's wrong in your configuration and how to fix it.
- 🎛️ Minimal API surface for ease of use.
- 🕣 Easy implementation of auto logout. Are you still there? You will be logged out in 10...9...
- ✨ Robust yet optional React integration.
- 📖 Comprehensive documentation and project examples: End-to-end solutions for authenticating your app.
- ✅ Best in class type safety: Enhanced API response types based on usage context.
Comparison with Existing Libraries
oidc-client-ts
While oidc-client-ts
serves as a comprehensive toolkit, our library aims to provide a simplified, ready-to-use adapter that will pass
any security audit and that will just work out of the box on any browser.
We utilize oidc-client-ts
internally but abstract away most of its intricacies.
react-oidc-context
react-oidc-context
is a React wrapper around oidc-client-ts
.oidc-spa
also feature a carefully crafted React API that comes with example
integration with:
keycloak-js
The official OIDC Client for Keycloak. It only works with Keycloak and will eventually be deprecated.
NextAuth.js
NextAuth.js is a authentication solution for Next.js and features a Keycloak adapter.oidc-spa
is specifically designed for Single Page Applications, Next.js projects do not fall in this category, so NextAuth.js is what you should use if you're using Next.js.
NOTE: We might create in the future a
oidc-mpa
library for Multi Page Applications that would aim at supporting Next.js projects.
🚀 Quick start
Heads over to the documentation website 📘!
Sponsors
Project backers, we trust and recommend their services.
Showcases
This library powers the authentication of the following platforms: