Fork of https://github.com/react-keycloak/react-keycloak.git with updated packages for Keycloak >=17. React bindings for Keycloak javascript adapter (core)
npm install @react-keycloak-refork/corekeycloak-js 26.0.0 or later
shell
yarn add @react-keycloak-refork/web
`
or
`shell
npm install --save @react-keycloak-refork/web
`
or as a UMD package through unpkg
See @react-keycloak-refork/web package README for complete documentation.
$3
React Keycloak for SSR frameworks requires:
- React 16.0 or later
- SSR Framework:
- NextJS 9 or later
- Razzle 3 or later
- keycloak-js 26.0.0 or later
`shell
yarn add @react-keycloak-refork/ssr
`
or
`shell
npm install --save @react-keycloak-refork/ssr
`
See @react-keycloak-refork/ssr package README for complete documentation.
$3
React Keycloak for React Native requires React Native 61.0 or later
To install run
`shell
yarn add @react-keycloak-refork/native
`
or
`shell
npm install --save @react-keycloak-refork/native
`
See @react-keycloak-refork/native package README for complete documentation.
Support
| version | keycloak-js version | notes |
| ------- | ------------------- | ------ |
| v6.0.0+ | 26.0.0+ | (fork) |
| v4.0.3+ | 26.0.0+ | (fork) |
| v4.0.1+ | 17.0.0+ | (fork) |
| v2.0.0+ | 9.0.2+ |
| v1.x | >=8.0.2 <9.0.2 |
Examples
See @react-keycloak-refork/react-keycloak-examples repository for various demo implementing this library main features.
Alternatives
If you need to connect using a more generic OIDC client instead of keycloak.js, consider using one of the following libraries:
- bjerkio/oidc-react
- thchia/react-oidc
- @axa-fr/react-oidc
Migration Notice
⚠️ This project is no longer maintained. For new projects, we strongly recommend using NextAuth.js instead, which provides:
- ✅ Active maintenance and security updates
- ✅ Support for 50+ OAuth providers including Keycloak
- ✅ Better TypeScript support
- ✅ Modern React patterns and hooks
- ✅ Comprehensive documentation and examples
- ✅ Active community and support
$3
To migrate from this library to NextAuth.js with Keycloak:
1. Install NextAuth.js: npm install next-auth
2. Configure Keycloak as a provider in your NextAuth configuration
3. Replace useKeycloak() hooks with NextAuth's useSession() and signIn()/signOut()` functions