> For the complete documentation index, see [llms.txt](https://docs.baas.sh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.baas.sh/baas-sdk/authentication/passkeys.md).

# Passkeys

Sign up new users and sign in returning ones with a passkey. The browser handles the rest in a single prompt.

## Sign up

For a brand-new user, create a passkey and sign them in:

```ts
const session = await baas.auth.signUpWithPasskey();
//  → { address: '0x…', accessToken: 'eyJ…', expiresAt: 1735689600 }
```

The browser asks the user to create a passkey, saved to iCloud Keychain, Google Password Manager, or another sync provider. On success, BaaS creates a fresh account and returns the session.

## Sign in

For a returning user, use their existing passkey:

```ts
const session = await baas.auth.signInWithPasskey();
```

If a valid session already exists, both methods return it immediately without showing a dialog.

{% hint style="info" %}
**Passkeys are scoped to your domain.** A passkey created on `app.example.com` is different from one on `example.com`. This is standard WebAuthn behaviour, not a bug. The same user on two domains has two distinct passkeys.
{% endhint %}

{% hint style="warning" %}
**Prefer synced passkeys.** The wallet address is derived from the passkey, so access to the account depends on it. On modern platforms, passkeys are usually **synced** (iCloud Keychain, Google Password Manager, 1Password, Bitwarden…) and survive a device change. A passkey that's bound to a single device, with no sync, is lost if that device is lost.

The SDK can't force the sync mode (the OS / authenticator decides), so encourage your users to keep their passkey manager's sync enabled.
{% endhint %}

## Next

* [External wallet](/baas-sdk/authentication/external-wallet.md) — let users sign in with MetaMask, Rainbow, or any EIP-1193 wallet.
* [Sessions](/baas-sdk/authentication/sessions.md) — read the session, listen for changes, and sign out.
* [Troubleshooting](/baas-sdk/troubleshooting.md) — common pitfalls, including the sign up vs sign in mistake.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.baas.sh/baas-sdk/authentication/passkeys.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
