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

Methodv1v2
.hosted.start()passage.hostedAuthStartpassage.hosted.start
.hosted.finish()passage.hostedAuthFinishpassage.hosted.finish
.magicLink.activate()passage.magicLinkActivatepassage.magicLink.activate
.magicLink.login()passage.newLoginMagicLinkpassage.magicLink.login
.magicLink.register()passage.newRegisterMagicLinkpassage.magicLink.register
.magicLink.status()passage.getMagicLinkStatuspassage.magicLink.status
.oneTimePasscode.activate()passage.oneTimePasscodeActivatepassage.oneTimePasscode.activate
.oneTimePasscode.login()passage.newLoginOneTimePasscodepassage.oneTimePasscode.login
.oneTimePasscode.register()passage.newRegisterOneTimePasscodepassage.oneTimePasscode.register
.passkey.register()passage.registerWithPasskeypassage.passkey.register
.passkey.login()passage.loginWithPasskeypassage.passkey.login
.passkey.currentUser.userInfo()passage.getCurrentUserpassage.currentUser.userInfo
.passkey.social.authorize()passage.authorizeWithpassage.social.authorize
.passkey.social.finish()passage.finishSocialAuthenticationpassage.social.finish
.passkey.tokenStore.refreshAuthToken()PassageTokenpassage.tokenStore.refreshAuthToken
.passkey.tokenStore.clearAndRevokeTokens()passage.revokeRefreshTokenpassage.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")