Add Passage
Add Passage to your Android project
Prerequisites
A recent version of Android Studio
Make sure that your project meets these requirements:
Targets API level 33 or higher
Uses Android 13 or higher
A Passage account (register for free if you haven’t already)
A Passage app (if you don't have one, learn how to create one here)
A device or emulator that meets passkey requirements (if your app uses passkeys)
If you don't already have an Android project and just want to try out Passage, you can clone our Android Example App.
Add the Passage SDK
In your module (app-level) Gradle file (usually <project>/<app-module>/build.gradle
), add the Passage dependency like this, and then sync your Android project with Gradle files:
Declare an instance of Passage
.
In your Activity’s onCreate()
or Fragment’s onViewCreated
method, initialize the Passage
instance.
If you are NOT using passkeys, that's it - you're ready to start using Passage!
If you ARE using passkeys, follow the below instructions
Configure app for passkeys
Step 1: Add your Android app in Passage Console
In the Passage Console, navigate to "Native Apps" and add your Android app. You'll need your app's package name and signing certificate fingerprint.
Generate signing certificate fingerprint
To get your signing certificate fingerprint, copy and paste this code in your terminal, replacing the placeholder all caps values:
Need help with finding or using your certificate? Learn more here.
Step 2: Publish Digital Asset Links file
If your Passage App is using Hosted Login, we automatically handle this for you. You can skip to Step 3.
Google's Digital Asset Links protocol enables an app or website to make public, verifiable statements about other apps or websites. Your website must declare that it is associated with your specific Android app, and declare that it wants to share user credentials in order for passkey authentication to work.
Get asset links JSON file
Click the menu button on your Native App in Passage Console to download your assetlinks.json
file.
Publish asset links JSON file
Publish this file to your site’s .well-known/
directory. Note that your Passage app's authentication origin must match the domain where this file is hosted.
Step 3: Configure asset statements
In "Native Apps" in Passage Console, you can get your app's associated domain. Use this value (minus the "https://") instead of YOUR_AUTH_ORIGIN
in the next step below.
Finally, paste the following meta-data
into your app’s AndroidManifest.xml
:
Step 4: App Linking (Required for Magic Link and Hosted Login)
If your app uses Magic Links or Hosted Login, you’ll likely want to setup your app with App Linking. This will direct users that click on an App Link in their email or messaging app on their Android device to your app, rather than to a browser.
In your app’s AndroidManifest.xml
file, add this intent filter to your <activity>
to enable App Linking:
If you're using Hosted Login, you can find the value for android:pathPrefix
in the Native Apps section of the console.
Last updated