Migrating from v7 to v8
Version 8 is a major release focused on universal runtime compatibility, PKCE authentication support, and API modernization.Update Requirements
Node.js Version
Change: Minimum Node.js version increased from 16 to 20.Package Type
The package is now ESM-first with dual CJS/ESM exports. Most users won’t need changes, but custom build configurations may require adjustments.Directory Sync Changes
DirectoryUser Interface
Changed: Removed top-level fields in favor ofcustomAttributes.
user.emails→ Useuser.customAttributes?.emailsuser.username→ Useuser.customAttributes?.usernameuser.jobTitle→ Useuser.customAttributes?.jobTitlegetPrimaryEmail()utility function
User Management Changes
Removed Methods
Authorization URL Options
Removed: Thecontext field is no longer supported.
List Organization Memberships
Changed: Now requires eitheruserId or organizationId.
SSO Changes
Authorization URL Options Type
Changed: Converted to discriminated union for better type safety.domain field (deprecated).
MFA Changes
Verify Factor Method
Changed: Method renamed for clarity.Organizations Changes
Organization Options
Removed fields:allowProfilesOutsideOrganizationdomains(usedomainDatainstead)
Vault Changes
Method Names
Changed: All*Secret methods renamed to *Object.
Events Changes
Event Types
Changed: Event type renamed.OrganizationMembershipAddedOrganizationMembershipRemoved
New Features in v8
PKCE Authentication
Version 8 adds full support for PKCE authentication, enabling public clients.See the User Management API and PKCE Flow guide for more details on PKCE authentication.
Type-Safe Client Modes
Use thecreateWorkOS() factory for compile-time type safety.
Universal Runtime Support
Version 8 works seamlessly across multiple JavaScript runtimes.Migration Checklist
Update Directory Sync
Replace
user.emails, user.username, and user.jobTitle with user.customAttributes.*Update User Management
- Remove
contextfrom authorization URL options - Add
userIdororganizationIdtolistOrganizationMemberships() - Update deprecated method names
Need Help?
If you encounter issues during migration:- Check the Changelog for detailed release notes
- Review the API Reference for updated method signatures
- Open an issue on GitHub
- Contact [email protected]