Upgrade to React Native Complete v1
In the latest update to Passage React Native, we've introduced several new classes and made structural changes specifically for React Native development. These updates are designed to provide a more intuitive interface and better alignment with React Native development best practices.
Handling app_id
v0
Optionally, the app_id
was passed from the strings.xml
file.
v1
Pass the app_id
directly as a string when initializing the Passage
instance.
This change simplifies the initialization process and ensures that the app_id
is provided explicitly in your code, reducing the potential for errors or misconfigurations.
const passage = Passage('YOUR_APP_ID');
New interface classes
Passage React Native v1 has a new interface system that is more robust and aligned with Passage conventions.
Passage class
This is the main entry point for interacting with the SDK. It now provides access to various components like App
, Passkey
, MagicLink
, OTP
, Social
, and more, each encapsulating specific functionalities related to user authentication.
App class
Handles operations related to the application, such as retrieving app information, checking if a user exists, and creating new users. This centralizes app-specific operations into one cohesive class.
Passkey class
Manages passkey-based authentication, including both registration and login functionalities.
MagicLink class
Facilitates the use of Magic Links for user registration, login, and activation, streamlining the process and making it more accessible.
OTP class
Provides methods for handling one-time passcodes, including registration, login, and activation, making it easier to integrate OTP functionalities.
Social class
Manages social login integrations, providing methods for authorizing and completing authentication with social providers.
CurrentUser class
Offers access to the current user's information and allows operations like changing email or phone, managing passkeys, and updating user metadata.
PassageHosted class
Specifically designed for apps using Passage's hosted authentication method, this class simplifies the process of starting and finishing hosted authentication.
Changes in method access
Method | v0 | v1 |
---|---|---|
.hosted.start() | passage.hostedAuthStart | passage.hosted.start |
.hosted.finish() | passage.hostedAuthFinish | passage.hosted.finish |
.magicLink.activate() | passage.magicLinkActivate | passage.magicLink.activate |
.magicLink.login() | passage.newLoginMagicLink | passage.magicLink.login |
.magicLink.register() | passage.newRegisterMagicLink | passage.magicLink.register |
.magicLink.status() | passage.getMagicLinkStatus | passage.magicLink.status |
.oneTimePasscode.activate() | passage.oneTimePasscodeActivate | passage.oneTimePasscode.activate |
.oneTimePasscode.login() | passage.newLoginOneTimePasscode | passage.oneTimePasscode.login |
.oneTimePasscode.register() | passage.newRegisterOneTimePasscode | passage.oneTimePasscode.register |
.passkey.register() | passage.registerWithPasskey | passage.passkey.register |
.passkey.login() | passage.loginWithPasskey | passage.passkey.login |
.passkey.currentUser.userInfo() | passage.getCurrentUser | passage.currentUser.userInfo |
.passkey.social.authorize() | passage.authorizeWith | passage.social.authorize |
.passkey.social.finish() | passage.finishSocialAuthentication | passage.social.finish |
.passkey.tokenStore.getValidAuthToken() | PassageToken | passage.tokenStore.getValidAuthToken |
.passkey.tokenStore.clearAndRevokeTokens() | passage.revokeRefreshToken | passage.tokenStore.clearAndRevokeTokens |