@otech_eng/sso-backend
v1.0.0
Published
Production-ready backend SSO token service for OTech ERP integration, enabling client JavaScript applications to act as trusted identity providers.
Maintainers
Readme
@otech_eng/sso-backend
Backend token generation for OTech ERP SSO, where a client's JavaScript application acts as the identity provider.
Installation
npm install @otech_eng/sso-backendTests
npm testTest files live in backend/tests.
CommonJS Usage
const ssoService = require("@otech_eng/sso-backend");
const token = ssoService.generateToken(
user,
accessControls,
process.env.SSO_AUDIENCE || "otech-erp",
process.env.SSO_SHARED_SECRET,
process.env.SSO_ISSUER || "otech-auth"
);ESM Usage
import ssoService, { generateToken } from "@otech_eng/sso-backend";
const tokenA = ssoService.generateToken(user, [], "otech-erp", secret, "otech-auth");
const tokenB = generateToken(user, [], "otech-erp", secret, "otech-auth");API
generateToken(user, accessControls, audience, secret, issuer?, options?)
- Validates required input (
user,audience,secret,user.id/sub) - Signs HS256 JWT with issuer/audience/subject
- Adds
jtiand short TTL by default
options supports expiresIn and overrides default TTL behavior.
ERP Trust Alignment
For successful SSO into OTech ERP, the following values must match between the client app and ERP setup:
secret(signing/verification)issuer(iss)audience(aud)
