Developer Documentation

Everything you need to integrate Ithbat IAM into your applications

SDKs & Libraries

Official client libraries to speed up your integration

JavaScript / TypeScript SDK

Installation

npm
npm install @ithbat/sdk
yarn
yarn add @ithbat/sdk

Configuration

JavaScript
import { IthbatAuth } from '@ithbat/sdk';

const auth = new IthbatAuth({
  domain: 'your-tenant.ithbat.io',
  clientId: 'YOUR_CLIENT_ID',
  redirectUri: window.location.origin + '/callback',
  audience: 'https://api.ithbat.io',
  scope: 'openid profile email'
});

Usage Examples

Login with Redirect

JavaScript
// Redirect to login page
auth.loginWithRedirect();

try {
  await auth.loginWithPopup();
  console.log('User logged in successfully');
} catch (error) {
  console.error('Login failed:', error);
}

Get Authenticated User

JavaScript
// Get authenticated user
const user = await auth.getUser();
console.log('User:', user);

const accessToken = await auth.getAccessToken();
console.log('Token:', accessToken);

const isAuthenticated = await auth.isAuthenticated();
console.log('Is authenticated:', isAuthenticated);

Logout User

JavaScript
// Logout user
auth.logout({
  returnTo: window.location.origin
});

Additional Resources