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

# Authenticate a user with a passkey credential

> ⚠️ **This example is outdated !**<br />
> Head over to [SDK Reference](https://docs.turnkey.com/sdks/react/sub-organization-customization) for the updated packages.

<Steps>
  <Step title="Initialize the Passkey Client">
    ```tsx theme={"system"}
    import { Turnkey } from "@turnkey/sdk-browser";

    const turnkey = new Turnkey({
      apiBaseUrl: "https://api.turnkey.com",
      defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID,
    });
    const passkeyClient = turnkey.passkeyClient();
    ```
  </Step>

  <Step title="Call the login function">
    ```tsx theme={"system"}
    const response = await passkeyClient.login();
    if (response.organizationId) {
      navigate("/authenticated-route");
    } else {
      navigate("/not-authenticated-route");
    }
    ```
  </Step>

  <Step title="Make read requests on behalf of the authenticated user from the currentUserSession">
    ```tsx theme={"system"}
    const currentUserSession = await turnkey.currentUserSession();
    const walletsResponse = await currentUserSession.getWallets();
    const walletName = walletsResponse.wallets[0].walletName;
    ```
  </Step>

  <Step title="Call the passkeyClient directly for write requests">
    This will always prompt a user to confirm the action with their passkey credential

    ```tsx theme={"system"}
    import { DEFAULT_ETHEREUM_ACCOUNTS } from "@turnkey/sdk-browser";
    const newWalletResponse = await passkeyClient.createWallet({
      walletName: "New Wallet for User",
      accounts: DEFAULT_ETHEREUM_ACCOUNTS,
    });
    ```
  </Step>
</Steps>
