AuthKit JavaScript SDK
The AuthKit JavaScript SDK provides a client-side library for integrating AuthKit authentication into vanilla JavaScript applications.
Refer to the AuthKit documentation for detailed usage instructions and examples.
Beta Versions
Certain WorkOS features may be available only in the beta version of the SDK. Beta versions have the-beta.* suffix, for example,
3.2.0-beta.1. For more information on how to use beta
versions, refer to the README in the GitHub repository.
Releases
v0.20.1
Latestv0.20.0
v0.19.0
What's Changed
- Stop unnecessarily setting screen_hint=sign-in by @cmatheson in #107
- Clear session organization on sign out or refresh error by @nholden in #110
Full Changelog: v0.18.0...v0.19.0
v0.18.0
What's Changed
Full Changelog: v0.17.0...v0.18.0
v0.17.0
What's Changed
- feat: enable npm Trusted Publishers by @nicknisi in #101
- Add authentication method to response interfaces and serializer by @ohjonah in #99
New Contributors
- @ohjonah made their first contribution in #99
Full Changelog: v0.16.0...v0.17.0
v0.16.0
What's Changed
- Revert emitting custom event with access token by @chaance in #96
Full Changelog: v0.15.0...v0.16.0
v0.15.0
What's Changed
- Emit custom event when token is refreshed by @chaance in #51
New Contributors
- @chaance made their first contribution in #51
Full Changelog: v0.14.0...v0.15.0
v0.14.0
What's Changed
New Contributors
- @atainter made their first contribution in #93
Full Changelog: v0.13.0...v0.14.0
v0.13.0
What's Changed
- Add
feature_flagsclaim on jwt interface by @kkajla12 in #89
Full Changelog: v0.12.0...v0.13.0
v0.12.0
What's Changed
- Add support for custom claims in
getClaimsfunction by @nicknisi in #87
Full Changelog: v0.11.0...v0.12.0
v0.11.0
What's Changed
- Remove 'impersonation coming soon' error message by @nholden in #80
- Deprecate
contextoption ongetAuthorizationUrlandsignInby @nholden in #83 - Add forceRefresh option to
getAccessTokenmethod by @nicknisi in #85 - Improve compatibility with hybrid mobile apps by @vdsbenoit in #84
- v0.11.0 by @nicknisi in #86
New Contributors
Full Changelog: v0.10.1...v0.11.0
v0.10.1
What's Changed
- Add coana-guardrail and coana-analysis workflows by @nicknisi in #74
- Add coana-guardrail and coana-analysis workflows by @nicknisi in #75
- fix: subsequent refreshes by @nananathanh in #78
- v0.10.1 by @nicknisi in #79
New Contributors
- @nananathanh made their first contribution in #78
Full Changelog: v0.10.0...v0.10.1
v0.10.0
Added
Full Changelog: v0.9.0...v0.10.0
v0.9.0
Added
- Added
returnTooption tosignOutby (#67)
v0.8.1
Fixes
- properly refreshes the session on page load (#66)
v0.8.0
Changes
- Avoids initial refresh when user has no session (https://github.com/workos/authkit-js/pull/61)
Fixes
- Throws error instead of returning stale access tokens when offline (https://github.com/workos/authkit-js/pull/63)
- Properly exports
OnRefreshResponsetype
v0.7.3
Changes
- export type
OnRefreshResponse
v0.7.2
Changes
onRefreshcallbacks no longer receive the refresh token (#58)
v0.7.1
Fixed
- Avoids an issue where multiple authentication requests could queue up when multiple
getAccessTokencalls are made when the token needs to be refreshed.
v0.7.0
Added
switchToOrganizationcan be used to switch a user's active organization.signInandsignUpnow takeorganizationIdandloginHintparameters.
v0.6.1
Fixed
- Under-the-hood changes to improve the locking and synchronization between tabs during session refresh. (#41)
v0.6.0
Added
- Added new
refreshBufferIntervaloption to configure how soon the client will attempt to refresh. (#39)
v0.5.1
Changed
Updated console error message with more explanation when a code could not be exchanged due to missing codeVerifier.
v0.5.0
Added context parameter to signIn()/signUp().
v0.4.1
fixes an issue where we repeatedly attempted to refresh the session after it had already ended.
v0.4.0
Changes
- Only proactively refreshes active tabs (inactive tabs will still be refreshed as necessary when
getAccessTokenis called). - Doesn't call
onRefreshFailureon the initial refresh request
Fixes
- authkit-js would previously return stale tokens after a browser lock error
Removes
refreshSession(getAccessTokenwill refresh when necessary)
v0.3.0
- Added
onRefreshErrorcallback - Changed:
getAccessTokenthrows aLoginRequiredErrorif an access token cannot be returned.
v0.2.2
Fixes
- refresh timing (#15)
v0.2.1
Fixes:
- Schedules token-refreshing after exchanging authorization code
- Calls
onRefresh()after successful code exchange response
v0.2.0
- Added
passwordResetTokenoption forsignIn()