AuthClientRestoreCredential extension

Android Restore Credentials ("zero-tap sign-in") on top of Supabase passkeys.

A restore key is a passkey that Android creates silently, backs up together with the app data, and makes available on the user's next device. Because the server side is the same as for passkeys, Supabase Auth stores and verifies restore keys as regular passkeys. Signing in with one on the new device yields a brand new session, independent of the refresh token chain of the old device, so it is safe to use as the credential restored during device setup.

Passkeys are a BETA feature and must be enabled for your project in the Supabase Dashboard under Authentication > Configuration > Passkeys. Android also requires Digital Asset Links for the relying party ID, exactly as for passkeys.

The platform calls are delegated to the RestoreCredentialInterface you pass in. The passkeys plugin's PasskeyAuthenticator implements it since passkeys 2.23.1, so the same object serves AuthClientPasskey.registerPasskey and these methods.

Restore Credentials only exist on Android. Guard the calls with defaultTargetPlatform == TargetPlatform.android.

Methods rethrow whatever the RestoreCredentialInterface throws when the platform call fails, for example when there is no restore key on the device, and throw AuthException when the Supabase server rejects the credential.

on
Annotations
  • @experimental

Methods

createRestoreKey(RestoreCredentialInterface restoreCredential, {String friendlyName = 'Android restore key', bool isCloudBackupEnabled = true}) → Future<Passkey>

Available on AuthClient, provided by the AuthClientRestoreCredential extension

Creates a restore key for the signed in user and registers it as a passkey.
signInWithRestoreKey(RestoreCredentialInterface restoreCredential, {String? captchaToken}) → Future<Session>

Available on AuthClient, provided by the AuthClientRestoreCredential extension

Signs the user in with the restore key on the device.