Get started
Introduction
Installation
Your first app
Tutorials
Fission tutorials
Add passkey sign-in to a shared Android and iOS app
Core concepts
Components
State and effects
Protected routes
Server-side rendering
Styling
Testing
Deployment
Reference
API reference
Cookbook
Fission 0.16.0
Documentation version
Read the changelog →

Add passkey sign-in to a shared Android and iOS app

Inspect real passkey prerequisites and an actually denied account route. Native sign-in remains blocked by the missing provider and verification service.
Android

What you will build

Keep the original shared native sign-in goal explicitly blocked until real credential and server verification establish an authorized session.
Treat an entered account label and host support as unverified prerequisites
Use the native Router and ProtectedRoute to leave account content unconstructed
Remove synthetic challenges and keep every account request denied until the real integration exists
Status: blocked — the original shared native sign-in goal is not fulfilled. Fission's current iOS shell installs UnsupportedPasskeyHost, and this tutorial has no relying-party server challenge or verification service. An associated domain, typed request or synthetic assertion cannot replace those missing pieces.
The distinction matters because a credential response is not an authenticated session. A server must verify it before the application may construct protected account content. We will keep that boundary visible whilst providing a real host-support diagnostic and actual Router-based denied account route. There is no memory-provider sign-in, hard-coded challenge or “continue anyway” action.

Create the shared diagnostic app

Complete Android SDK/NDK setup and iOS setup first.
cargo install cargo-fission
fission init mobile-build-a-multi-screen-mobile-sign-in-and-account-flow
cd mobile-build-a-multi-screen-mobile-sign-in-and-account-flow
fission add-target android ios --project-dir .
fission add-capability passkeys --project-dir .
cargo add serde_yaml
Keep the generated src/main.rs. The library installs the same app, route handler, translations and actual target provider on normal native and Web launches. Web uses hash routing so the embedded preview does not take over the documentation path.

Run the finished example

fission run --target android --project-dir .

1. Start with what the app can establish

The person may enter an account label and query passkey availability. The label is explicitly unverified user input. A supported secure host may help satisfy a prerequisite, but the account selector still returns Deny because no server has verified a session.
ProtectedRoute constructs the denied branch without constructing account content. This is a real presentation boundary, not a button which toggles a fake signed-in flag. The incomplete integration deliberately has no path which grants account access.
{"id":"fission-tabs-1","tabs":[{"index":0,"label":"src/app.rs","value":"src-app-rs"},{"index":1,"label":"src/app/state.rs","value":"src-app-state-rs"},{"index":2,"label":"src/app/screen.rs","value":"src-app-screen-rs"},{"index":3,"label":"src/app/routes.rs","value":"src-app-routes-rs"},{"index":4,"label":"src/i18n.rs","value":"src-i18n-rs"},{"index":5,"label":"src/lib.rs","value":"src-lib-rs"},{"index":6,"label":"preview/lib.rs","value":"preview-lib-rs"},{"index":7,"label":"i18n/en-US.yaml","value":"i18n-en-us-yaml"},{"index":8,"label":"i18n/es-ES.yaml","value":"i18n-es-es-yaml"}]}
{"id":"fission-tabs-1","index":0,"label":"src/app.rs","value":"src-app-rs"}
mod routes;
mod screen;
pub mod state;
pub use routes::AccountApp;
pub use state::{route_changed, AccountState};
{"id":"fission-tabs-1","index":1,"label":"src/app/state.rs","value":"src-app-state-rs"}
use fission::prelude::*;

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct AccountState {
    pub locale: Locale,
    pub current_path: String,
    pub account_label: String,
    pub pending: bool,
    pub message_key: String,
    pub diagnostic: Option<String>,
}
impl Default for AccountState {
    fn default() -> Self {
        Self {
            locale: Locale::from("en-US"),
            current_path: "/".into(),
            account_label: String::new(),
            pending: false,
            message_key: "check.ready".into(),
            diagnostic: None,
        }
    }
}
impl GlobalState for AccountState {}

pub fn check_host(state: &mut AccountState, cx: &mut ReducerContext<AccountState>) {
    if state.pending {
        return;
    }
    state.pending = true;
    state.message_key = "check.pending".into();
    state.diagnostic = None;
    let ok = cx.effects.bind(HostChecked, reduce_with!(host_checked));
    let err = cx
        .effects
        .bind(HostCheckFailed, reduce_with!(host_check_failed));
    cx.effects.passkeys().availability().on_ok(ok).on_err(err);
}

#[fission_reducer(HostChecked)]
fn host_checked(state: &mut AccountState, cx: &mut ReducerContext<AccountState>) {
    state.pending = false;
    match cx.input.capability_ok(GET_PASSKEY_AVAILABILITY) {
        Some(value) => {
            state.message_key = if value.supported && value.secure_context {
                "check.available"
            } else {
                "check.unavailable"
            }
            .into();
            state.diagnostic = Some(format!("{value:?}"));
        }
        None => state.message_key = "check.invalid".into(),
    }
}

#[fission_reducer(HostCheckFailed)]
fn host_check_failed(state: &mut AccountState, cx: &mut ReducerContext<AccountState>) {
    state.pending = false;
    match cx.input.capability_error(GET_PASSKEY_AVAILABILITY) {
        Some(error) => {
            state.message_key = if error.code == "unsupported" {
                "check.unavailable"
            } else {
                "check.failed"
            }
            .into();
            state.diagnostic = Some(format!("{}: {}", error.code, error.message));
        }
        None => state.message_key = "check.invalid".into(),
    }
}

pub fn route_changed(
    state: &mut AccountState,
    action: fission::core::action::ShellRouteChanged,
    _cx: &mut ReducerContext<AccountState>,
) {
    state.current_path = action.location.pathname;
}

// There is no session-verification service in this example. Host support is
// never an authorization input. The unfinished integration must fail closed.
pub fn account_route_decision(_state: &AccountState) -> RouteDecision {
    RouteDecision::Deny
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn support_or_an_entered_account_cannot_authorize_access() {
        let mut state = AccountState::default();
        state.account_label = "[email protected]".into();
        state.message_key = "check.available".into();
        assert!(matches!(
            account_route_decision(&state),
            RouteDecision::Deny
        ));
    }
}
{"id":"fission-tabs-1","index":2,"label":"src/app/screen.rs","value":"src-app-screen-rs"}
use super::state::{check_host, AccountState};
use fission::prelude::*;

fission_component! {
    pub SignInScreen<AccountState> {}
    view(_screen, state, cx) {
        let tokens = &cx.view.env().theme.tokens;
    } => Column(gap: tokens.spacing.m, children: [
        Text(cx.tr("account.sign_in")).size(tokens.typography.heading2_size),
        Text(cx.tr("account.blocked")),
        FormControl(
            label: Some(cx.tr("account.label")),
            helper: Some(cx.tr("account.label_help")),
            child: TextInput(value: state.account_label.clone(), bind(on_input): to(state.account_label),
                keyboard_type: TextInputType::EmailAddress),
        ),
        if !state.account_label.trim().is_empty() {
            Text(cx.tr("account.entered").replace("{account}", state.account_label.trim()))
        },
        Button(child: Text(cx.tr("check.request")), key: "check-host", disabled: state.pending,
            on_press: reduce { check_host(state, cx); }),
        if state.pending {
            Spinner(motion: Some(SpinnerMotion::Default), label: Some(cx.tr("check.pending")))
        },
        Text(cx.tr(&state.message_key)),
        if let Some(details) = &state.diagnostic { Code(text: details.clone()) },
        Button(child: Text(cx.tr("account.inspect_route")), key: "inspect-account",
            on_press: reduce { cx.effects.navigate("/account"); }),
        Text(cx.tr("account.no_authentication")).color(tokens.colors.text_secondary),
    ])
}

fission_component! {
    pub AccountContent<AccountState> {}
    view(_account, _state, cx) => Text(cx.tr("account.protected_placeholder"))
}

fission_component! {
    pub AccountBlocked<AccountState> {}
    view(_blocked, _state, cx) => Column(gap: cx.view.env().theme.tokens.spacing.m, children: [
        Text(cx.tr("account.denied")),
        Button(child: Text(cx.tr("account.return")), key: "return-sign-in",
            on_press: reduce { cx.effects.replace_route("/"); }),
    ])
}
{"id":"fission-tabs-1","index":3,"label":"src/app/routes.rs","value":"src-app-routes-rs"}
use super::screen::{AccountBlocked, AccountContent, SignInScreen};
use super::state::{account_route_decision, AccountState};
use fission::prelude::*;

fission_component! {
    pub UnknownRoute<AccountState> {}
    view(_unknown, _state, cx) => Column(children: [
        Text(cx.tr("account.unknown")),
        Button(child: Text(cx.tr("account.return")), key: "recover",
            on_press: reduce { cx.effects.replace_route("/"); }),
    ])
}

fission_component! {
    pub AccountApp<AccountState> {}
    view(_app, state, cx) {
        let tokens = &cx.view.env().theme.tokens;
        let router = Router::<AccountState>::new()
            .with_path(state.current_path.clone())
            .route_component("/", SignInScreen)
            .route_component("/account",
                ProtectedRoute::new(account_route_decision(state), AccountContent)
                    .denied(AccountBlocked))
            .not_found(|| UnknownRoute);
    } => SafeArea(child: Scroll(child: Container(Column(gap: tokens.spacing.m, children: [
        Row(gap: tokens.spacing.s, children: [
            Button(child: Text(cx.tr("language.english")), key: "english",
                on_press: reduce { state.locale = Locale::from("en-US"); }),
            Button(child: Text(cx.tr("language.spanish")), key: "spanish",
                on_press: reduce { state.locale = Locale::from("es-ES"); }),
        ]),
        router,
    ])).padding_all(tokens.spacing.l)))
}
{"id":"fission-tabs-1","index":4,"label":"src/i18n.rs","value":"src-i18n-rs"}
use fission::i18n::{Locale, TranslationBundle};
use fission::prelude::*;
use std::collections::HashMap;

pub fn create_env() -> Env {
    let mut env = Env::default();
    env.locale = Locale::from("en-US");
    for (locale, source) in [
        ("en-US", include_str!("../i18n/en-US.yaml")),
        ("es-ES", include_str!("../i18n/es-ES.yaml")),
    ] {
        let messages: HashMap<String, String> =
            serde_yaml::from_str(source).expect("valid navigation translations");
        env.i18n.add_bundle(TranslationBundle {
            locale: Locale::from(locale),
            messages,
        });
    }
    env
}

pub fn sync_env(state: &crate::app::AccountState, env: &mut Env) {
    env.locale = state.locale.clone();
}
{"id":"fission-tabs-1","index":5,"label":"src/lib.rs","value":"src-lib-rs"}
pub mod app;
mod i18n;

use app::{AccountApp, AccountState};
use fission::prelude::*;

#[cfg(not(any(target_arch = "wasm32", target_os = "android", target_os = "ios")))]
pub fn run_desktop() -> anyhow::Result<()> {
    DesktopApp::<AccountState, _>::new(AccountApp)
        .with_env(i18n::create_env())
        .with_sync_env(i18n::sync_env)
        .with_route_handler(app::route_changed)
        .run()
}

#[cfg(any(target_os = "android", target_os = "ios"))]
pub fn run_mobile() -> anyhow::Result<()> {
    MobileApp::<AccountState, _>::new(AccountApp)
        .with_env(i18n::create_env())
        .with_sync_env(i18n::sync_env)
        .with_route_handler(app::route_changed)
        .run()
}

#[cfg(target_os = "android")]
#[no_mangle]
fn android_main(app_handle: AndroidApp) {
    let _ = MobileApp::<AccountState, _>::new(AccountApp)
        .with_env(i18n::create_env())
        .with_sync_env(i18n::sync_env)
        .with_route_handler(app::route_changed)
        .run_with_android_app(app_handle);
}

#[cfg(target_arch = "wasm32")]
#[wasm_bindgen::prelude::wasm_bindgen(start)]
pub fn run_web() -> Result<(), wasm_bindgen::JsValue> {
    console_error_panic_hook::set_once();
    WebApp::<AccountState, _>::new(AccountApp)
        .with_navigation(WebNavigationConfig::new(WebRouteStrategy::Hash))
        .with_env(i18n::create_env())
        .with_sync_env(i18n::sync_env)
        .with_route_handler(app::route_changed)
        .run()
        .map_err(|error| wasm_bindgen::JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1","index":6,"label":"preview/lib.rs","value":"preview-lib-rs"}
mod app;
mod i18n;

use fission::prelude::*;
use wasm_bindgen::prelude::*;

#[wasm_bindgen(start)]
pub fn run() -> Result<(), JsValue> {
    console_error_panic_hook::set_once();
    let window =
        web_sys::window().ok_or_else(|| JsValue::from_str("browser window unavailable"))?;
    let base_path = window.location().pathname()?;
    WebApp::<app::AccountState, _>::new(app::AccountApp)
        .with_env(i18n::create_env())
        .with_sync_env(i18n::sync_env)
        .with_route_handler(app::route_changed)
        .with_navigation(WebNavigationConfig::new(WebRouteStrategy::Hash).base_path(base_path))
        .mount("#fission-web-mount")
        .run()
        .map_err(|error| JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1","index":7,"label":"i18n/en-US.yaml","value":"i18n-en-us-yaml"}
account.sign_in: "Account sign-in prerequisites"
account.blocked: "This native passkey flow is blocked: there is no installed iOS credential provider or server challenge/verification integration."
account.label: "Account label"
account.label_help: "This identifies your intended account only. It is not a verified identity."
account.entered: "Entered account: {account} — not verified"
account.inspect_route: "Inspect the blocked account route"
account.no_authentication: "Checking host support never signs you in. No credential request or server verification is performed."
account.protected_placeholder: "Protected account content must remain unconstructed in this incomplete integration."
account.denied: "Account access is denied. No verified session exists."
account.return: "Return to sign-in prerequisites"
account.unknown: "This route does not exist."
check.request: "Check this host's passkey support"
check.ready: "No host-support check has been requested."
check.pending: "Waiting for the host-support response…"
check.available: "This host reports secure passkey support. Nobody has been signed in."
check.unavailable: "The active host cannot provide passkey authentication."
check.failed: "The support check failed. Inspect the diagnostic details."
check.invalid: "The host returned no usable typed result."
language.english: "English"
language.spanish: "Español"
{"id":"fission-tabs-1","index":8,"label":"i18n/es-ES.yaml","value":"i18n-es-es-yaml"}
account.sign_in: "Requisitos de inicio de sesión"
account.blocked: "El flujo nativo está bloqueado: faltan el proveedor de credenciales de iOS y la integración de desafío y verificación del servidor."
account.label: "Identificador de cuenta"
account.label_help: "Solo identifica la cuenta prevista. No es una identidad verificada."
account.entered: "Cuenta introducida: {account} — sin verificar"
account.inspect_route: "Inspeccionar la ruta de cuenta bloqueada"
account.no_authentication: "Comprobar el host no inicia sesión. No se solicita ninguna credencial ni se verifica con un servidor."
account.protected_placeholder: "El contenido protegido no debe construirse en esta integración incompleta."
account.denied: "Acceso denegado. No existe ninguna sesión verificada."
account.return: "Volver a los requisitos de inicio de sesión"
account.unknown: "Esta ruta no existe."
check.request: "Comprobar claves de acceso en este host"
check.ready: "No se ha solicitado ninguna comprobación."
check.pending: "Esperando la respuesta del host…"
check.available: "El host indica compatibilidad segura con claves de acceso. Nadie ha iniciado sesión."
check.unavailable: "El host activo no proporciona autenticación con claves de acceso."
check.failed: "La comprobación falló. Revisa los detalles de diagnóstico."
check.invalid: "El host no devolvió un resultado tipado utilizable."
language.english: "Inglés"
language.spanish: "Español"
{"id":"fission-tabs-1"}
Enter an account label, check host support and open the account route. Access must remain denied even when the browser reports support. Return to the public screen and confirm that the entered label remains app state, not a verified identity.
Show the app preview
Hide the app preview

2. Complete authentication before enabling the account route

The intended flow is: ask the service for a fresh challenge, request a real credential for its relying-party identity, send the assertion back to that service, then accept only its verified session result. Cancellation, no credential, expired challenge and verification failure leave the user signed out. A retry requires another fresh challenge.
The challenge belongs to the server's authentication attempt, not a string generated in a view. The server verifies the expected challenge, relying party, origin/application association, credential and account policy using a maintained WebAuthn implementation. Keep assertions short-lived in memory and do not log or persist them as debugging fixtures.
For iOS, configure the signed app's webcredentials association and the domain's apple-app-site-association document as well as installing a genuine AuthenticationServices provider. Android has its own app/domain association and credential-provider requirements. The portable capability declaration does not implement either platform integration by itself.
Once those dependencies exist, replace the deliberately denied selector with one pure selector over resolved session state: pending whilst session hydration runs, signed-out redirect, authenticated-and-authorized allow, otherwise deny. Register startup hydration unconditionally before queuing its action. Do not scatter redirect side effects through protected screens.
cargo test --lib
The included test checks only the current fail-closed rule. It does not verify any credential or server session. This goal remains blocked until the real authentication path is implemented and qualified.
Navigating directly to the account route, retrying a host check or changing the account label must never turn this diagnostic into a successful sign-in.
Show the app preview
Hide the app preview

3. Verify launch and authentication as separate claims

These commands check each configured native host:
fission doctor android --project-dir .
fission run --target android --project-dir .
fission test --target android --project-dir .
fission doctor ios --project-dir .
fission run --target ios --project-dir .
fission test --target ios --project-dir .
Use an Android phone and a signed iPhone build when the real providers and service are available. Until then, report the missing integration rather than claiming that launching the diagnostic qualified sign-in.
Route protection does not authorize server requests. The protected API must independently authenticate the session and enforce account access. Do not send secret account data to this client merely because its Router would hide a component.