Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • KeycloakInitOptions

Index

Properties

adapter?: "default" | "cordova" | "cordova-native" | KeycloakAdapter

Allow usage of different types of adapters or a custom adapter to make Keycloak work in different environments.

The following options are supported:

  • default - Use default APIs that are available in browsers.
  • cordova - Use a WebView in Cordova.
  • cordova-native - Use Cordova native APIs, this is recommended over cordova.

It's also possible to pass in a custom adapter for the environment you are running Keycloak in. In order to do so extend the KeycloakAdapter interface and implement the methods that are defined there.

For example:

import Keycloak, { KeycloakAdapter } from 'keycloak-js';

// Implement the 'KeycloakAdapter' interface so that all required methods are guaranteed to be present.
const MyCustomAdapter: KeycloakAdapter = {
login(options) {
// Write your own implementation here.
}

// The other methods go here...
};

const keycloak = new Keycloak();

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

Set to enable/disable monitoring login state.

default

true

checkLoginIframeInterval?: number

Set the interval to check login state (in seconds).

default

5

enableLogging?: boolean

Enables logging messages from Keycloak to the console.

default

false

Set the OpenID Connect flow.

default

standard

idToken?: string

Set an initial value for the id token (only together with token or refreshToken).

messageReceiveTimeout?: number

Configures how long will Keycloak adapter wait for receiving messages from server in ms. This is used, for example, when waiting for response of 3rd party cookies check.

default

10000

Specifies an action to do on load.

pkceMethod?: "S256"

Configures the Proof Key for Code Exchange (PKCE) method to use. The currently allowed method is 'S256'. If not configured, PKCE will not be used.

redirectUri?: string

Specifies a default uri to redirect to after login or logout. This is currently supported for adapter 'cordova-native' and 'default'

refreshToken?: string

Set an initial value for the refresh token.

responseMode?: KeycloakResponseMode

Set the OpenID Connect response mode to send to Keycloak upon login.

default

fragment After successful authentication Keycloak will redirect to JavaScript application with OpenID Connect parameters added in URL fragment. This is generally safer and recommended over query.

silentCheckSsoFallback?: boolean

Specifies whether the silent check-sso should fallback to "non-silent" check-sso when 3rd party cookies are blocked by the browser. Defaults to true.

silentCheckSsoRedirectUri?: string

Specifies an uri to redirect to after silent check-sso. Silent check-sso will only happen, when this redirect uri is given and the specified uri is available whithin the application.

timeSkew?: number

Set an initial value for skew between local time and Keycloak server in seconds (only together with token or refreshToken).

token?: string

Set an initial value for the token.

useNonce?: boolean

Adds a cryptographic nonce to verify that the authentication response matches the request.

default

true

Generated using TypeDoc