Get Started
Get Started with Passage for Android
If you haven’t already, you'll need to add Passage to your Android project.
Check current auth state
Declare an instance of Passage
.
In your Activity’s onCreate()
or Fragment’s onViewCreated
method, initialize the Passage
instance.
When initializing your Activity or Fragment, check to see if the user is currently signed in.
Register new user
The Passage class comes with a convenient, simplified register
method that will attempt to:
Prompt the user to create a passkey
On successful passkey creation, method will create a new user account and return a
PassageAuthResult
that contains the user’s tokensOn a user cancellation or failure of passkey creation, method will use your Passage app’s fallback method (one-time passcode or magic link) and return a
PassageAuthFallbackResult
that contains the fallback type (otp
ormagicLink
) and an id used for verification.
If you want more granular control or visibility into the passkey flows, we recommend using the Passkey Authentication methods instead.
To learn how to handle the fallback cases shown in the code snippet above, visit Fallback Authentication.
Log in existing user
The Passage class comes with a simplified login
method that will attempt to:
Prompt the user to login with a passkey
On successful passkey login, method will return a
PassageAuthResult
that contains the user’s tokensOn a user cancellation or failure of passkey login, method will use your Passage app’s fallback method (one-time passcode or magic link) and return a
PassageAuthFallbackResult
that contains the fallback type (otp
ormagicLink
) and an id used for verification.
Want more? 🤩
These simplified register
and login
methods do a lot of heavy lifting for you, but you might want more customized behavior or visibility into the process. If so, let's get into Passkey Authentication!
Last updated