Skip to main content

Okta Integration

Connect Okta Identity Cloud to authenticate end users interacting with your Char AI widget. This guide walks you through creating an OIDC application in Okta and configuring Char AI to validate tokens.

Prerequisites

  • An Okta organization (production or preview)
  • Admin access to create applications in Okta
  • Access to the Char AI dashboard

Configuration Steps

1

Create an OIDC Application in Okta

  1. Sign in to your Okta Admin Console
  2. Navigate to ApplicationsApplications
  3. Click Create App Integration
  4. Select OIDC - OpenID Connect as the sign-in method
  5. Select Single-Page Application as the application type
  6. Click Next
2

Configure Application Settings

Configure your new application:
SettingValue
App integration nameChar AI Widget (or your preferred name)
Grant typeAuthorization Code (with PKCE)
Sign-in redirect URIsYour application’s callback URL
Sign-out redirect URIsYour application’s logout URL
Controlled accessAssign to appropriate groups or allow everyone
Click Save to create the application.
3

Note Your Client ID and Domain

After creating the application:
  1. Copy the Client ID from the application’s General tab
  2. Note your Okta domain (e.g., acme.okta.com or acme.oktapreview.com)
Okta Client ID location

Find your Client ID in the Okta application settings

4

Configure Char AI

In the Char AI Dashboard:
  1. Navigate to SettingsIntegration
  2. Under SSO Configuration, select Okta as the provider
  3. Enter your Client ID from Step 3
  4. Enter your Okta domain (e.g., acme.okta.com)
  5. Click Test Connection to verify
  6. Click Save Changes

Configuration Reference

Char AI FieldOkta ValueExample
Provider TypeOktaokta
Client IDApplication Client ID0oa1b2c3d4e5f6g7h8i9
DomainYour Okta domainacme.okta.com
Okta preview environments use *.oktapreview.com domains. Both production and preview domains are supported.

Token Requirements

Char AI validates Okta tokens with these requirements:
ClaimRequirement
issMust match https://{your-domain}
audMust include your configured Client ID
subRequired - used as the user identifier
expMust not be expired

Example: Obtaining and Passing the Token

Once your Okta application is configured, obtain the ID token after authentication and pass it to the Char widget:
import OktaAuth from '@okta/okta-auth-js';
import { CharWidget } from '@char-ai/widget';

const oktaAuth = new OktaAuth({
  issuer: 'https://acme.okta.com',
  clientId: '0oa1b2c3d4e5f6g7h8i9',
  redirectUri: window.location.origin + '/callback',
});

// After authentication
const tokens = await oktaAuth.tokenManager.getTokens();

CharWidget.init({
  siteId: 'your-site-id',
  userToken: tokens.idToken.idToken,
});

Troubleshooting

Verify your Okta domain is correctly configured:
  • Domain should not include https:// prefix
  • Domain should match exactly (e.g., acme.okta.com)
  • For preview environments, use *.oktapreview.com
The token’s aud claim doesn’t match your configured Client ID:
  • Ensure the Client ID in Char matches your Okta application exactly
  • Verify you’re using the ID token, not the access token
  • Check that your Okta application is configured as a Single-Page Application
Char AI couldn’t reach Okta’s JWKS endpoint:
  • Verify your Okta domain is correct
  • Check that Okta is accessible (not blocked by firewall)
  • Use Test Connection in the dashboard to verify connectivity
If tokens expire quickly:
  • Check your Okta application’s token lifetime settings
  • Consider refreshing tokens before they expire
  • Verify your server and Okta have synchronized clocks

Security Best Practices

Always configure the Client ID. Without audience validation, tokens from other applications in your Okta organization could be used to access your widget.
  • Use HTTPS for all redirect URIs
  • Restrict application access to only the users/groups who need it
  • Regularly rotate tokens by implementing proper session management
  • Monitor Okta system logs for suspicious authentication attempts