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 device or emulator that meets passkey requirements
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)
If you don't already have an Android project and just want to try out Passage, you can clone our Android Example App.
Step 1: Publish Digital Asset Links file
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.
Generate signing certificate fingerprint
To securely associate your website with your Android app, Google requires your Digital Asset Links JSON file to contain the SHA256 fingerprint of your app’s signing certificate.
To get your signing certificate fingerprint, copy and paste this code in your terminal, replacing the placeholder all caps values:
The output should include something like this:
Need help with finding or using your certificate? Learn more here.
Create asset links JSON file
Create a new assetlinks.json
file like this one, replacing the YOUR_WEBSITE
, YOUR_ANDROID_PACKAGE_NAME
, and YOUR_CERT_FINGERPRINT
values:
Note that YOUR_WEBSITE
must match your Passage app's auth origin
Publish asset links JSON file
Publish this file to your site’s .well-known/
directory.
Step 2: Register your Android app with Passage
For passkeys to work in any Android app, Google requires the app's "APK key hash" to be set as the relying party's auth origin.
Generate your key hash
To get the key hash from your signing certificate, simply copy and paste this code in your terminal, replacing YOUR_SHA256_FINGERPRINT
with the SHA256 fingerprint generated from the previous step:
Which should produce something like:
Submit key hash in Passage Console
In Passage Console, you’ll need to submit your android apk key hash in Settings -> General -> Android SDK.
Step 3: Add Passage SDK to your Android app
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:
Then in your app’s strings.xml
file, copy and past the following, replacing YOUR_APP_ID
and YOUR_AUTH_ORIGIN
:
Finally, paste the following meta-data
into your app’s AndroidManifest.xml
:
You did it! 🎉
The hard part is over! It's time to Get Started using Passage.
Last updated