Upgrade to v4
Breaking changes from PassageJS v3 to v4
TypeScript updates
Passage-JS v4 has a new type system that is more robust and aligned with TypeScript conventions. Most types returned by Passage-JS methods have been updated and renamed. Additionally all interface fields now consistently use camelCase instead of snake_case.
For example the updated PassageAppInfo type is:
interface PassageAppInfo {
allowedIdentifier: string;
authMethods: AuthMethods;
authOrigin: string;
defaultLanguage: string;
elementCustomization: ElementCustomization;
elementCustomizationDark: ElementCustomization;
id: string;
layouts: Layouts;
loginUrl: string;
name: string;
passageBranding: boolean;
publicSignup: boolean;
profileManagement: boolean;
redirectUrl: string;
requireEmailVerification: boolean;
requireIdentifierVerification: boolean;
requiredIdentifier: string;
rsaPublicKey: string;
sessionTimeoutLength: number;
socialConnections: SocialConnections;
userMetadataSchema: Array<UserMetadataField>;
}Method reorganization
Passage-JS v4 introduces a new class-based organization to the API that organizes methods into classes based on their functionality. When upgrading to v4 you will need to update your code to use the new class-based methods.
You can see the full Passage-JS v4 API reference can be found in the README of the NPM package @passageidentity/passage-js.
App methods
| V3 method | V4 method |
|---|---|
|
|
|
|
|
|
Passkey methods
| V3 method | V4 method |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MagicLink methods
| V3 method | V4 method |
|---|---|
|
|
|
|
|
|
|
|
OneTimePasscode methods
| V3 method | V4 method |
|---|---|
|
|
|
|
|
|
Social methods
| V3 method | V4 method |
|---|---|
|
|
|
|
CurrentUser methods
The old currentUser methods were already in a CurrentUser class that was accessed through getCurrentUser(). In v4 the currentUser class in now accessed through the currentUser property on the main Passage class.
Some of the methods have updated types or have been renamed:
| V3 method | V4 method |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Session methods
The Session class is unchanged from Passage-JS v3, however it was previously accessed through getCurrentSession() and is now accessed through the session property on the main Passage class.
| V3 method | V4 property |
|---|---|
getCurrentSession(): Session | session: PassageSession |