Skip to content

feat(gotrue): add passkey (WebAuthn) support - #1392

Merged
spydon merged 3 commits into
mainfrom
feat/gotrue-passkeys
Jun 15, 2026
Merged

spydon merged 3 commits into
mainfrom
feat/gotrue-passkeys

Conversation

@spydon

@spydon spydon commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Feature. Closes #1369.

Adds support for the Supabase Auth Passkeys (BETA) API (/passkeys/* endpoints), mirroring the two-step auth.passkey.* API surface of auth-js.

What is the new behavior?

New supabase.auth.passkey namespace (GoTruePasskeyApi):

  • startRegistration() / verifyRegistration(challengeId:, credential:) to register a passkey for the signed-in user
  • startAuthentication(captchaToken:) / verifyAuthentication(challengeId:, credential:) to sign in with a passkey; persists the session and fires AuthChangeEvent.signedIn
  • list(), update(passkeyId:, friendlyName:), delete(passkeyId:) for management

New supabase.auth.admin.passkey namespace (GoTrueAdminPasskeyApi) with listPasskeys(userId:) and deletePasskey(userId:, passkeyId:).

Supporting changes:

  • New types: Passkey, PasskeyRegistrationOptionsResponse, PasskeyAuthenticationOptionsResponse
  • PATCH support in GotrueFetch (used by the passkey rename endpoint)
  • FactorType.webauthn, a webauthn bucket in mfa.listFactors(), AMRMethod.passkey and AMRMethod.mfaWebauthn
  • New server error codes in ErrorCode (passkey_disabled, webauthn_*, mfa_webauthn_*, too_many_passkeys)

Design notes

  • The native WebAuthn ceremony (FaceID/TouchID/security key prompt) is left to the app via a platform plugin (e.g. credential_manager, or navigator.credentials on web). Options and credentials are exchanged as Map<String, dynamic> in the W3C WebAuthn L3 JSON format, which is what those plugins accept and produce. This matches the two-step auth.passkey.start*/verify* API in auth-js; its one-call signInWithPasskey() performs the ceremony in-browser, which a pure Dart package cannot do cross-platform. A high-level helper on top of a pluggable authenticator interface is a possible follow-up, as is the separate MFA WebAuthn factor flow.
  • auth-js gates this API behind experimental: { passkey: true } with a call-time throw. Instead of plumbing a runtime flag through three packages, the API is annotated with @experimental from package:meta so consumers get analyzer warnings. The server independently rejects calls with passkey_disabled when the dashboard toggle is off.

Tests

31 unit tests against a mock server client covering all endpoints and wire format (snake_case bodies, JWT headers, 204 deletes, top-level array responses), session/event side effects, model parsing edge cases, and error mapping. End-to-end tests against the dockerized GoTrue server are not feasible since the server cryptographically verifies attestations/assertions, which would require a software authenticator; auth-js has the same limitation.

Additional context

Passkeys must be enabled per project in the Dashboard under Authentication > Configuration > Passkeys (BETA). Docs (Dart reference spec and the passkeys guide in supabase/supabase) will follow after release.

@github-actions github-actions Bot added the auth This issue or pull request is related to authentication label Jun 11, 2026
@spydon
spydon marked this pull request as ready for review June 11, 2026 08:37
@spydon
spydon requested a review from a team as a code owner June 11, 2026 08:37
@spydon
spydon force-pushed the feat/gotrue-passkeys branch from 077c115 to dda0ec5 Compare June 11, 2026 08:40
@grdsdev

grdsdev commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Looks good!

I'd like to see an e2e app implementing this so we can really make sure it works.

As a follow up, write a complete guide on how to do the full native ceremony using an well known platform plugin, would be even better if we could offer that in the SDK so users don't need to implement it themselves.

For Swift, I'm adding the signInWithPasskey method under a #if canImport(AuthenticationService) check, can't we do something similar for Flutter?

@spydon

spydon commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

I'd like to see an e2e app implementing this so we can really make sure it works.

I have that locally, I can post it in a temporary repo on Monday.

As a follow up, write a complete guide on how to do the full native ceremony using an well known platform plugin

That's the plan!

For Swift, I'm adding the signInWithPasskey method under a #if canImport(AuthenticationService) check, can't we do something similar for Flutter?

Unfortunately there aren't conditional dependencies in Dart, but we do have full tree shaking, so might be worth adding a dependency anyways. The only potential problem is future dependency version resolution problems, but we should be able to handle those.

@grdsdev grdsdev left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved!

@spydon
spydon merged commit 3e890b5 into main Jun 15, 2026
18 checks passed
@spydon
spydon deleted the feat/gotrue-passkeys branch June 15, 2026 12:41
grdsdev added a commit to supabase/supabase that referenced this pull request Jun 17, 2026
## Summary

Updates docs based on stable releases in `supabase/supabase-flutter`.

## Changes analyzed

- **SDK**: dart
- **Repo**: https://github.com/supabase/supabase-flutter
- **Stable tag range**:
`supabase_flutter-v2.14.1...supabase_flutter-v2.15.0`
- **Commits**:
`81c1590728a5e08bebdc152bd59a7c1e7644c8b2...9030650b74e253020f8c614b3bfb2c993b6061af`

## Documentation updates

`apps/docs/spec/supabase_dart_v2.yml` — adds entries for the new passkey
APIs landed in `supabase_flutter-v2.15.0`
([gotrue#1392](supabase/supabase-flutter#1392),
[supabase_flutter#1408](supabase/supabase-flutter#1408)):

- `signInWithPasskey()` / `registerPasskey()` — high-level helpers on
`supabase_flutter` that drive the full WebAuthn ceremony.
- `auth.passkey.*` — server side of the WebAuthn ceremony: `list`,
`update`, `delete`, `startRegistration`, `verifyRegistration`,
`startAuthentication`, `verifyAuthentication`.
- `auth.admin.passkey.*` — admin endpoints: `listPasskeys`,
`deletePasskey`.

`apps/docs/content/guides/auth/passkeys.mdx` — adds Dart code examples
to every passkey section (Enable in the client, Register, Sign in,
Two-step API, Manage, Admin API) and points the reference links at both
the JavaScript and Dart specs. Bumps the "Requires" admonition to
include `supabase_flutter v2.15.0`.

Other v2.14.2 / v2.15.0 changes that did not require doc updates:

- `feat(realtime): protocol format 2.0.0` — protocol versions are
already documented in `realtime/protocol.mdx`; the SDK now defaults to
v2.0.0 but exposes a `version: RealtimeProtocolVersion.v1` opt-out,
which is an SDK detail rather than a docs change.
- `fix(gotrue): support asymmetric JWTs in getClaims` — bug fix to the
existing `auth.getClaims` (no new API).
- The rest are bug fixes and internal refactors (storage
`createSignedUrls` null handling, postgrest stack traces, gotrue
refresh-token races, PKCE email-change, realtime deaf-socket guards,
lint/test/CI hygiene).

`common-client-libs-sections.json` already contains entries for every
new spec `id`, so the sidebar nav picks them up automatically.

---

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Added Dart language examples to passkey authentication guide covering
client initialization, user registration, sign-in workflows, two-step
ceremony flows, and passkey management operations
* Updated Dart client specification to document new passkey
authentication functions and admin-level passkey management capabilities

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
matlin pushed a commit to supabase/supabase that referenced this pull request Jun 22, 2026
## Summary

Updates docs based on stable releases in `supabase/supabase-flutter`.

## Changes analyzed

- **SDK**: dart
- **Repo**: https://github.com/supabase/supabase-flutter
- **Stable tag range**:
`supabase_flutter-v2.14.1...supabase_flutter-v2.15.0`
- **Commits**:
`81c1590728a5e08bebdc152bd59a7c1e7644c8b2...9030650b74e253020f8c614b3bfb2c993b6061af`

## Documentation updates

`apps/docs/spec/supabase_dart_v2.yml` — adds entries for the new passkey
APIs landed in `supabase_flutter-v2.15.0`
([gotrue#1392](supabase/supabase-flutter#1392),
[supabase_flutter#1408](supabase/supabase-flutter#1408)):

- `signInWithPasskey()` / `registerPasskey()` — high-level helpers on
`supabase_flutter` that drive the full WebAuthn ceremony.
- `auth.passkey.*` — server side of the WebAuthn ceremony: `list`,
`update`, `delete`, `startRegistration`, `verifyRegistration`,
`startAuthentication`, `verifyAuthentication`.
- `auth.admin.passkey.*` — admin endpoints: `listPasskeys`,
`deletePasskey`.

`apps/docs/content/guides/auth/passkeys.mdx` — adds Dart code examples
to every passkey section (Enable in the client, Register, Sign in,
Two-step API, Manage, Admin API) and points the reference links at both
the JavaScript and Dart specs. Bumps the "Requires" admonition to
include `supabase_flutter v2.15.0`.

Other v2.14.2 / v2.15.0 changes that did not require doc updates:

- `feat(realtime): protocol format 2.0.0` — protocol versions are
already documented in `realtime/protocol.mdx`; the SDK now defaults to
v2.0.0 but exposes a `version: RealtimeProtocolVersion.v1` opt-out,
which is an SDK detail rather than a docs change.
- `fix(gotrue): support asymmetric JWTs in getClaims` — bug fix to the
existing `auth.getClaims` (no new API).
- The rest are bug fixes and internal refactors (storage
`createSignedUrls` null handling, postgrest stack traces, gotrue
refresh-token races, PKCE email-change, realtime deaf-socket guards,
lint/test/CI hygiene).

`common-client-libs-sections.json` already contains entries for every
new spec `id`, so the sidebar nav picks them up automatically.

---

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Added Dart language examples to passkey authentication guide covering
client initialization, user registration, sign-in workflows, two-step
ceremony flows, and passkey management operations
* Updated Dart client specification to document new passkey
authentication functions and admin-level passkey management capabilities

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth This issue or pull request is related to authentication

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Passkeys / WebAuthn support in Flutter SDK

2 participants