Skip to main content

`<ThunderIDProvider />`

Cloud has the newest features. Some may not be in a release yet; the newest release is Identity & Access Management 7.3.0.

The ThunderIDProvider is the root context provider component that configures @thunderid/react and provides Choreo Identity & Access Management context to your entire React application. It must wrap your application to enable authentication features.

Overview​

The <ProductName />Provider initializes the Choreo Identity & Access Management authentication client, manages authentication state, and provides context to child components through React Context. It handles token management, user sessions, organization switching, and branding preferences automatically.

Usage​

The ThunderIDProvider must be used at the root of your React application to ensure that all components have access to authentication features.

Basic Usage​

A minimal setup involves wrapping your root component with the ThunderIDProvider and providing the necessary clientId and baseUrl props.

src/main.jsx
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from "./App.jsx"
import { ThunderIDProvider } from '@thunderid/react'

createRoot(document.getElementById('root')).render(
<StrictMode>
<ThunderIDProvider
clientId="<your-app-client-id>"
baseUrl="https://<DATA_PLANE_URL>"
>
<App />
</ThunderIDProvider>
</StrictMode>
)

Advanced Usage​

For more advanced configurations, you can provide additional props such as:

  • scopes: Specifies the OpenID Connect scopes to request during sign-in.
  • afterSignInUrl: URL to redirect to after successful sign-in.
  • afterSignOutUrl: URL to redirect to after sign-out.
  • preferences: Customization options for UI behavior, theming, and internationalization (i18n).
  • etc.

For a complete list of props, refer to the Props section below.

src/main.jsx
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from "./App.jsx"
import { ThunderIDProvider } from '@thunderid/react'

createRoot(document.getElementById('root')).render(
<StrictMode>
<ThunderIDProvider
clientId="<your-app-client-id>"
baseUrl="https://<DATA_PLANE_URL>"
scopes="openid profile internal_login internal_organization_create internal_organization_view internal_organization_update internal_organization_delete"
afterSignInUrl="/dashboard"
afterSignOutUrl="/home"
preferences={{
theme: {
inheritFromBranding: false,
mode: 'dark',
overrides: {
colors: {
primary: '#ff0000',
},
},
},
i18n: {
language: 'fr-FR',
fallbackLanguage: 'en-US',
bundles: {
'fr-FR': {
'signin.title': 'Connexion',
'user.profile.title': 'Profil utilisateur',
'user.profile.update.generic.error': "Une erreur s'est produite lors de la mise à jour du profil. Veuillez réessayer.",
},
'es-ES': {
'signin.title': 'Iniciar sesión',
'user.profile.title': 'Perfil de usuario',
'user.profile.update.generic.error': 'Ocurrió un error al actualizar el perfil. Por favor, inténtalo de nuevo.',
},
},
},
}}
>
<App />
</ThunderIDProvider>
</StrictMode>
)

Props​

The ThunderIDProvider component accepts the following props:

PropTypeRequiredDescription
clientIdstring✅Client ID of your application
baseUrlstring✅The base URL of the Choreo Identity & Access Management instance (e.g., https://<DATA_PLANE_URL>)
clientSecretstring❌Client secret of your application. Only required for confidential clients.
scopesstring | string[]❌OpenID Connect Scopes to request during the sign-in. Defaults to 'openid profile internal_login' if not provided.
storagesessionStorage or localStorage | webWorker❌Storage mechanism to use for session management. Defaults to sessionStorage if not provided.
sessionSessionConfig❌Behaviour around the Choreo Identity & Access Management session. Set session.silentSignIn.beforeRedirect to true to try a silent sign-in before signIn() redirects. The silent attempt is skipped when the sign-in options set their own prompt. session.silentSignIn.timeout (milliseconds, default 10000) bounds how long a silent sign-in waits. See Browser configuration.
afterSignInUrlstring❌URL to redirect to after sign-in process is completed.
afterSignUpUrlstring❌URL to redirect to after sign-up process is completed.
afterSignOutUrlstring❌URL to redirect to after sign-out process is completed.
tokenValidationTokenValidation❌Configuration for token validation.
preferencesPreferences❌Customization options for UI behavior, internationalization (i18n) and styling.
http{ fetcher?: (url: string, config: RequestInit) => Promise<Response> }❌HTTP options. http.fetcher is the transport for the management hooks and applies to management operations only. Defaults to the SDK's authenticated HTTP client. A fetcher passed to an individual hook takes precedence.

TokenValidation​

The tokenValidation prop allows you to configure how ID tokens are validated.

PropertyTypeDefaultDescription
idTokenIdTokenValidation{}Configuration for ID token validation

IdTokenValidation​

PropertyTypeDefaultDescription
validateIssuerbooleantrueWhether to validate the issuer
clockTolerancenumber300Allowed clock skew in seconds

Preferences​

The preferences prop allows you to customize the UI components provided by the SDK.

Theme Preferences (preferences.theme)​

PropertyTypeDefaultDescription
inheritFromBrandingbooleantrueWhether to inherit theme from Choreo Identity & Access Management organization/application branding
modelight | dark | system'system'Theme mode. 'system' follows user's OS preference
overridesThemeConfig{}Custom theme overrides for colors, typography, spacing, etc.

Internationalization Preferences (preferences.i18n)​

PropertyTypeDefaultDescription
languagestringBrowser defaultLanguage code for UI text (e.g., 'en-US', 'es-ES')
fallbackLanguagestring'en-US'Fallback language when translations aren't available
bundlesobject{}Custom translation bundles to override default text

Was this page helpful?