Upgrade to Android Complete v2
In the latest update to Passage Android, we've introduced several new classes and made structural changes specifically for native Android development. These updates are designed to provide a more intuitive interface and better alignment with Android development best practices.
How to Update Your Implementation
Refactor Method Calls
Update your code to use the new structure. Learn more about the Interface classes.
Directly Pass app_id
Ensure that the app_id
is passed directly in your code instead of being pulled from the strings.xml
file. Learn more about the new app_id
changes.
New Interface classes
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 | v1 | v2 |
---|---|---|
.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.refreshAuthToken() | PassageToken | passage.tokenStore.refreshAuthToken |
.passkey.tokenStore.clearAndRevokeTokens() | passage.revokeRefreshToken | passage.tokenStore.clearAndRevokeTokens |
Handling app_id
v1
app_id
is passed from the strings.xml
file.
v2
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.
val passage = Passage(activity, "your_app_id_here")