> ## Documentation Index
> Fetch the complete documentation index at: https://docs.median.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Passkey authentication (WebAuthn)

> Let users sign in to your app with passkeys and Face ID, Touch ID, or fingerprint unlock, using the WebAuthn standard on iOS and Android.

Median's Passkey Authentication plugin connects your website (running inside your native app) to the device's built-in biometrics. This allows your users to sign in to your app using native Face ID, Touch ID, or Android Fingerprint Unlock.

It's built on the FIDO/WebAuthn standard, offering a phishing-resistant, passwordless alternative that's simpler for users and more secure for your business.

> [!TIP]
>
> **Developer Demo**
>
> You can explore a sample implementation on the [Passkey demo page](https://median.dev/passkey).
>
> **Note**: The WebAuthn / Passkey functionality operates entirely within your web implementation. It does not require the Median JavaScript Bridge.

## Key features

* **Boost security and stop phishing:** Passkeys are cryptographically secure and tied directly to your website. This technology makes it virtually impossible for users to be phished, as there's no password to steal.
* **Improve user conversion:** Remove the friction of forgotten passwords. Users can sign in instantly with their face or fingerprint, for a smoother, faster experience that reduces drop-off.
* **Use native device security hardware:** The plugin connects your web content directly to the device's secure hardware (like the Secure Enclave or Android Keystore).

### How it works

At a high level, passkey authentication replaces traditional passwords. The user's device creates and stores a unique cryptographic key. This key is split into two parts: a **private key** that *never* leaves the user's device and a **public key** that is sent to your server.

1. A user taps the "Sign in" button on your website *inside the app*.
2. The website requests a challenge from your server.
3. On Android, the plugin intercepts this call and triggers the native biometric prompt (e.g., "Sign in with Touch ID"). On iOS the native plugin isn't required, but your domain needs Web Credentials selected in App Studio and the Apple App Site Association (AASA) file hosted.
4. Once the user verifies, the device signs the challenge and passes it back to your website.
5. Your website sends this proof to your server to complete the login.

Median bridges the gap between your web-based login flow and the native biometric hardware, making this high-security feature possible in your app.

### Use cases

* **Secure e-commerce checkouts:** Allow customers to authenticate quickly to complete a purchase or access their order history.
* **HIPAA/Financial app logins:** Provide a compliant and highly secure login method for users accessing sensitive health or financial data.
* **Internal employee portals:** Let employees sign in to internal tools using the same biometrics they use to unlock their work phones.

## Implementation

Follow these steps to integrate native passkey (WebAuthn) authentication into your Median app.

## Before you start

* **Median App Studio access:** You need access to your app's build configuration in App Studio to add the plugin.
* **A WebAuthn-compliant server:** You must have a backend (Relying Party) capable of generating and verifying FIDO2/WebAuthn registration challenges and login assertions.
* **Associated Domains / Asset Links:** You must have Apple Associated Domains (for iOS) and Android Digital Asset Links (for Android) configured for your website. This is a non-negotiable security requirement from Apple and Google for passkeys to function.
* You have implemented `/passkey/register` and `/passkey/login` endpoints to handle challenge generation and verification.

### Android setup

#### 1. Add the digital certificate

Host a file at `/.well-known/assetlinks.json` publicly on your website. This file must contain your digital certificate information and include the permission `delegate_permission/common.get_login_creds`.

This file allows Android devices to associate your domain with your app during passkey authentication, enabling the passkey flow to work correctly on Android.

**Example:** [https://median.dev/.well-known/assetlinks.json](https://median.dev/.well-known/assetlinks.json)

**Important: All Asset Links and Apple App Site Association (AASA) files need to be publicly accessible**

For non-public development environments, you can publicly expose AASA and Asset Links files by using an allowlist reverse proxy, a public static bucket/CDN, an API gateway, an edge worker, or a dedicated micro-site while keeping the rest of the environment private. An example can be found in our blog [How to serve AASA and Digital Asset Links files with Cloudflare Workers](https://median.co/blog/how-to-serve-aasa-and-digital-asset-links-files-with-cloudflare-workers).

#### 2. Configure the expected origin

Your server must verify the origin of each WebAuthn request (registration or authentication). On Android, the origin format is different from standard web origins and includes your app's signing certificate fingerprint.

The Android origin format is:

`android:apk-key-hash:<BASE64URL-encoded SHA-256 fingerprint of the APK's signing certificate>`

**Example:** `android:apk-key-hash:SLxaRtkJ-LAxf5rY4kusSv21KMenqeVKovFHMT-hPkI`

**Generate the fingerprint:**

Run this command in your terminal (replace `<your-alias>`, `release.keystore`, and `<your-keystore-password>` with your actual values):

```bash bash theme={null}
keytool -exportcert -alias <your-alias> -keystore release.keystore -storepass <your-keystore-password> | \
openssl sha256 -binary | \
openssl base64 | \
tr '+/' '-_' | tr -d '='
```

#### 3. Configure authenticator selection

When creating WebAuthn registration options for passkey enrollment, you must include both the legacy `requireResidentKey` field and the modern `residentKey` field in your `authenticatorSelection` object.

**Why both fields?** Android's WebAuthn implementation requires the legacy `requireResidentKey` field, even though it's deprecated in the WebAuthn specification. For maximum compatibility across all browsers and Android, include both fields.

**Configuration example:**

```json JSON theme={null}
"authenticatorSelection": {
  "requireResidentKey": true,         // Required for Android compatibility
  "residentKey": "required",          // Modern WebAuthn field
  "userVerification": "preferred"
}
```

**Understanding `requireResidentKey`:**

This field determines whether the passkey is stored on the device:

* **true** - The passkey is saved on the device (discoverable credential). Users can authenticate without entering their username.
* **false** - The passkey is not saved on the device. Only your server stores the credential reference, and users must provide their username to authenticate.

#### 4. Configure Median App Studio plugin

After completing the website configuration steps above, configure the WebAuthn plugin in Median App Studio:

1. In Median App Studio, navigate to **Native Plugins > WebAuthn (Android)**
2. Configure the **allowedUrls** parameter with URL patterns that specify which domains can create passkey requests
3. Save the configuration

**Parameter details:**

* **allowedUrls** - A list of URL patterns that are allowed to create passkey requests. This helps prevent unauthorized passkey creation from untrusted domains.

![WebAuthn (Android) plugin configuration with allowedUrls in App Studio](https://mintcdn.com/median-co/7LCOHMhgIef7ewYE/images/docs/4ef7604b4a80b14f79da7dfab5241f3baa4ee6465d65f8a8060613070c2d1017-Screenshot_2026-02-05_at_10.47.42.png?fit=max\&auto=format\&n=7LCOHMhgIef7ewYE\&q=85\&s=ec6c9a8058ce9e7e83c41aec411afac5)

App Studio: passkey plugin configuration

### iOS setup

On iOS the native plugin isn't required. Instead, select Web Credentials for your domain in App Studio and host the Apple App Site Association (AASA) file it generates.

#### 1. Select Web Credentials for your domain

In App Studio, go to **Link Handling → Universal Links / Deep Links / Web Credentials**, add your website's domain, and select **Web Credentials** for it. App Studio adds your domain to the iOS app when it's built, and includes a `webcredentials` object in the `apple-app-site-association` file it generates. This file tells iOS that your app can use the passkeys saved for your domain.

Rebuild your app after you change your domains. See [Web Credentials configuration](https://docs.median.co/docs/deep-linking#web-credentials-configuration) for the full setup.

**Example AASA with Web Credentials**

The `applinks` object is only included when a domain also uses Universal Links.

```json JSON theme={null}
/* Example - /apple-app-site-association with Web Credentials */
{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "TEAMID.co.median.example",
        "paths": ["*"]
      }
    ]
  },
  "webcredentials": {
    "apps": ["TEAMID.co.median.example"]
  }
}
```

#### 2. Host your AASA file

Download the file from App Studio, replace `<Team ID>` with your [Apple Team ID](https://developer.apple.com/help/glossary/team-id/), and upload it to your domain.

If your site uses multiple subdomains (such as `example.com`, `www.example.com`, and `support.example.com`), add each one in App Studio with **Web Credentials** selected, and host the `apple-app-site-association` file on each.

You must host the /apple-app-site-association file with a Content-Type: application/json HTTP header, using https\:// with a valid SSL certificate, and with a 200 HTTP Status Code with no redirects.


## Related topics

- [Authentication](https://docs.median.co/docs/authentication.md)
- [Base44](https://docs.median.co/docs/base44.md)
- [Changelog archive](https://docs.median.co/docs/changelog-archive.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.