Cross Platform Android Configuration

Configure your Flutter or React Native app for Android

Publish digital asset links file

Skip if your Passage App is using Hosted Login.

To enable support for passkeys for the Android version of your mobile app, Google requires that you associate your app with a website that your app owns by publishing a Digital Asset Links file. Instructions can be found in our Android Complete SDK docs.

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. Instructions on how to get and add this key hash for your Passage app can be found in our Android Complete SDK docs.

Add Passage auth origin to your Android app

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.

Copy the Associated Domain value in ConsoleCopy the Associated Domain value in Console
<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>

Your app's strings.xml file can be found at:

<app root directory>/android/app/src/main/res/values/strings.xml

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>

Your app's AndroidManifext.xml file can be found at:

<app root directory>/android/app/src/main/AndroidManifest.xml

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 (opens in a new tab). 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:

//..
<activity
    android:name=".MainActivity"
    android:exported="true"
    android:launchMode="singleInstance">
    //..

    <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="http" />
        <data android:scheme="https" />
        <data android:host="@string/passage_auth_origin" />
        // Required Line for Only Hosted Authentication
        <data android:pathPrefix="/android/"YOUR_PACKAGE_NAME"/>
    </intent-filter>

</activity>
//..

If you're using Hosted Login, you can find the value for android:pathPrefix in the Native Apps section of the console.

Screen showing where to find the callback URL for Android in the console