Node SDK
The OhAuthCat server SDK for Node.js 20 and later: management API, SSO helpers and webhook verification.
Node.js 20 or later.
Install
Section titled “Install”npm install @ohauthcat/nodeConfigure
Section titled “Configure”new OhAuthCat(options) takes apiKey (the secret key, sk_...) and, for sign-in, clientId (the publishable key, pk_...) and environmentId (env_...). Optional: timeoutMs, maxRetries, and apiBaseUrl / authBaseUrl for any deployment other than production. Keep the client on your server.
First call
Section titled “First call”Every API operation is a method on its resource, named after the operation: await client., or await client.. client. is an async iterator over every page.
SSO: client. returns { url, codeVerifier }; keep the verifier on your server. On the callback, await client. exchanges the code once. The Node quickstart shows the whole flow.
Errors
Section titled “Errors”Every API error is an OhAuthCatError with the stable code, status, type, param, docUrl and requestId; see the error codes. PlanLimitReachedError adds the metric a plan refused. RestartSignIn means the code exchange cannot be retried: start a fresh sign-in.
Webhooks
Section titled “Webhooks”webhooks. checks the OhAuthCat-Signature header against the exact raw body bytes and returns the event. Pass every secret you hold during a rotation. A refusal throws WebhookVerificationError whose code is, for example, signature_invalid or timestamp_outside (older than 300 seconds).
Reference
Section titled “Reference”Every method maps to an operation in the API reference; webhook payloads are in webhook events.