Skip to main content
Prerequisite:
If you haven’t already, check out the External Wallets Overview first, this guide builds on the concepts introduced there.

Setting up wallet authentication

The toggle to enable wallet authentication is available in the TurnkeyProvider configuration. Wallet authentication can also be set in the dashboard, but the TurnkeyProvider configuration takes precedence. You can further customize settings, such as which chains are enabled, which providers are supported, and whether WalletConnect is allowed.
Note:
  • For authentication to work, you must define at least one ethereum or solana chain, either as native or with walletConnectNamespaces.
  • To enable WalletConnect, you must configure both the walletConnect object and define walletConnectNamespaces in at least one chain (e.g., ethereum or solana).

Wallet authentication

There are two paths you can take: let us handle it for you, or build it yourself. We recommend letting us do the heavy lifting using our built-in modal.

Option 1: Use the auth modal

If you want a fully styled, plug-and-play experience, use our Auth modal. It handles the entire authentication flow for you.
Below are screenshots of what the default UI looks like out of the box when using the built-in Auth modal:
Wallet Auth ModalWallet Chain Select
WalletConnect QR Modal
Note: this UI is customizable. Checkout the UI Customization guide to learn how to customize the look and feel of the Auth modal and other UI components.

Option 2: Build a custom auth flow

There are a few ways to authenticate users with their wallets. We provide several abstraction functions that handle authentication, each with slightly different behavior:
  1. loginWithWallet()
  2. signUpWithWallet()
  3. loginOrSignUpWithWallet()
All three generally follow the same flow, with only minor differences in implementation. For this guide, we’ll use loginOrSignUpWithWallet() as the reference, since it’s the most commonly used approach.
1

Get the WalletProvider you want to use

2

Log in or sign up with that wallet

How does this look structurally in a Turnkey organization?

If you’re just looking to implement wallet authentication in your app, you don’t need to worry about the internal structure. But if you’re curious about how these flows map to Turnkey’s organization model under the hood, here’s a deeper look: At its core, a wallet is just a key pair. When a user signs up with a wallet, Turnkey creates a sub-org for that user and sets up the public key of the wallet as an authenticator for that sub-org. From then on, whenever the user wants to log in, they call stampLogin(). This involves signing the login payload with the same wallet key pair.