Add Passage

Add Passage to your Android project

Prerequisites

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:

dependencies {
  // ...
  implementation 'id.passage.android:passage:1.5.1'
}

Declare an instance of Passage.

lateinit var passage: Passage

In your Activity’s onCreate() or Fragment’s onViewCreated method, initialize the Passage instance.

passage = Passage(requireActivity(), "YOUR_APP_ID")

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:

keytool -list -v -keystore PATH_TO_KEYSTORE -alias KEYSTORE_ALIAS -storepass STORE_PASSWORD -keypass KEY_PASSWORD

Need help with finding or using your certificate? Learn more here.

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.

Click the menu button on your Native App in Passage Console to download your assetlinks.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 your app’s strings.xml file, copy and past the following, replacing YOUR_AUTH_ORIGIN:

<resources>
    //..

    <!-- Required Passage app settings -->
    <string name="passage_auth_origin">YOUR_AUTH_ORIGIN</string>
    <string name="asset_statements">
      [{
        \\"include\\": \\"https://@string/passage_auth_origin/.well-known/assetlinks.json\\"
      }]
    </string>

</resources>

Finally, paste the following meta-data into your app’s AndroidManifest.xml:

<manifest ...>
    <application ...>

        <meta-data
          android:name="asset_statements"
          android:resource="@string/asset_statements" />

    </application>
</manifest>

Last updated