@react-keycloak/keycloak-ts
TypeScript icon, indicating that this package has built-in type declarations

0.2.4 • Public • Published

KeycloakTS

Typescript porting of Keycloak javascript client

🚧 WIP: Under development 🚧

NPM (scoped)

License Github Issues

Gitter


Table of Contents


Install

yarn add @react-keycloak/keycloak-ts

or

npm install @react-keycloak/keycloak-ts

Getting Started

KeycloakTS provides a porting of the original Keycloak javascript adapter to allow better extensibility and usage on different platform by using custom adapters.

Create a custom KeycloakAdapter

Create a class which implements the KeycloakAdapter interface

import type { KeycloakAdapter } from '@react-keycloak/keycloak-ts';

// Wrap everything inside ReactNativeKeycloakProvider
class MyCustomAdapter implements KeycloakAdapter {
  ...
};

export default MyCustomAdapter;

Setup Keycloak instance

import { KeycloakClient } from '@react-keycloak/keycloak-ts';

import MyCustomAdapter from './adapter.ts';

// Setup Keycloak client as needed
// Pass initialization options as required
const keycloak = new KeycloakClient({
  url: 'http://keycloak-server/auth',
  realm: 'kc-realm',
  clientId: 'web'
});

// Call init passing a custom adapter

keycloak.init({
  adapter: MyCustomAdapter,
});

export default keycloak;

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Package Sidebar

Install

npm i @react-keycloak/keycloak-ts

Weekly Downloads

1,641

Version

0.2.4

License

MIT

Unpacked Size

234 kB

Total Files

38

Last publish

Collaborators

  • panz3r
  • irontony