Back to skills
SKILL.md
Workos
ASecurity> **Verification Tier:** `code_example_tested` | **Last Verified:** 2026-11-18 > **Official Docs:** https://workos.com/docs/user-management
- 13 stars
- 0 votes
- 0 copies
- 0 views
- Added December 2, 2026
Works with
Security analysis
92/100- Installs packages at runtime which could introduce malicious dependencies
- Installs packages at runtime which could introduce malicious dependencies
Pro scans all 2 files and shows the line behind each finding
npx -y skills add ashish7802/awesome-api-skills --skill workos --agent claude-codeAre you the author of Workos?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ashish7802-workos)# WorkOS API & SDK Skill
> **Verification Tier:** `code_example_tested` | **Last Verified:** 2026-11-18
> **Official Docs:** https://workos.com/docs/user-management
## Overview
WorkOS provides enterprise-ready authentication (AuthKit), SAML/OIDC Single Sign-On, SCIM Directory Sync, Fine-Grained Authorization (FGA), and Audit Logs.
## Installation
```bash
npm install @workos-inc/node
pip install workos
```
## Authentication
Configure `WORKOS_API_KEY` (`sk_live_...` / `sk_test_...`), `WORKOS_CLIENT_ID` (`client_...`), and `WORKOS_COOKIE_PASSWORD` (at least 32 characters for sealed session cookies) via environment variables.
## Core Concepts
- **AuthKit Authorization Flow**: Redirect users via `workos.userManagement.getAuthorizationUrl({ provider: "authkit", redirectUri, clientId, state })` (or `getAuthorizationUrlWithPKCE` for public clients) and exchange the callback `code` via `workos.userManagement.authenticateWithCode({ code, clientId })`.
- **JWT Verification**: Verify access tokens server-side against WorkOS JWKS rather than trusting decoded unverified JWT claims.
- **Webhooks**: Verify Directory Sync and User Management webhooks with `workos.webhooks.constructEvent({ payload, sigHeader, secret })` using the raw request body.
## Error Handling & Rate Limits
- Handle `401` (expired/revoked session -> refresh via refresh token), `422` (invalid authorization code or mismatched `redirectUri`), and `429` rate-limit responses with backoff.
- Always validate the CSRF `state` parameter on OAuth callback routes before calling `authenticateWithCode`.
## Security Best Practices
- Store session tokens in `HttpOnly`, `Secure`, `SameSite=Lax` encrypted cookies—never in `localStorage`.
- Always pass the raw unparsed request body string to `workos.webhooks.constructEvent`.
- Enforce organization membership checks (`organizationId`) on every multi-tenant API route.
## AI Pitfalls
- Skipping OAuth `state` validation on the callback handler (CSRF/login-fixation risk).
- Parsing JSON before verifying WorkOS webhook signatures.
- Confusing `WORKOS_CLIENT_ID` (safe identifier) with `WORKOS_API_KEY` (strictly server-side secret).
## Production Checklist
- [ ] `WORKOS_API_KEY` and `WORKOS_COOKIE_PASSWORD` loaded from env vars only
- [ ] OAuth callback validates cryptographic `state` nonce
- [ ] Session cookies set `HttpOnly`, `Secure`, `SameSite=Lax`
- [ ] Webhook handler verifies `workos-signature` against raw body
## References
- [WorkOS User Management Docs](https://workos.com/docs/user-management)
- [WorkOS Node SDK](https://github.com/workos/workos-node)
## Related skills
- [`clerk`](../clerk/SKILL.md) — alternative to
- [`auth0`](../auth0/SKILL.md) — alternative to
- [`nextjs`](../nextjs/SKILL.md) — integrates with
Files in this skill
- SKILL.md
- examples/quickstart.ts
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.