@otech_eng/sso-frontend
v1.0.0
Published
Production-ready frontend SSO handoff utilities for OTech ERP integration, allowing client JavaScript applications to authenticate users into ERP.
Maintainers
Readme
@otech_eng/sso-frontend
Framework-agnostic frontend utilities for handing off authenticated users from a client JavaScript app to OTech ERP.
Installation
npm install @otech_eng/sso-frontendTests
npm testTest files live in frontend/tests.
Works In
- Plain browser JavaScript
- React, Vue, Angular, Svelte
- Bundlers and runtimes using either ESM (
import) or CommonJS (require)
API
triggerSSO(apiEndpoint, targetBaseUrl, authToken, options?)
Fetches an SSO token from your client backend and submits it to ${targetBaseUrl}/auth/sso/callback via hidden form POST.
createSSOClient(defaults?)
Creates a reusable client with defaults (apiEndpoint, targetBaseUrl, authToken, options).
useSSO()
Compatibility helper that returns { triggerSSO }. This is not React-specific and can be used anywhere.
ESM Usage
import { triggerSSO, createSSOClient } from "@otech_eng/sso-frontend";
await triggerSSO(apiEndpoint, targetBaseUrl, authToken, {
allowedTargetOrigins: [new URL(targetBaseUrl).origin],
});
const sso = createSSOClient({
apiEndpoint,
targetBaseUrl,
options: { timeoutMs: 10000 },
});
await sso.triggerSSO(undefined, undefined, authToken);CommonJS Usage
const { triggerSSO } = require("@otech_eng/sso-frontend");
await triggerSSO(apiEndpoint, targetBaseUrl, authToken);Integration Context
- Your client JavaScript application remains the identity provider.
- OTech ERP accepts the signed token and creates the ERP session.
issuer,audience, and shared secret must match ERP-side configuration.
