Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
eth_requestAccounts – 1auth
Skip to content

eth_requestAccounts

Prompts the user to connect their wallet to your dApp. If the user hasn't authenticated before, this opens the passkey registration/login flow. If already authenticated but not connected to your app, it shows a lightweight connect prompt. This is the standard method for initiating wallet connection.

Try it

Parameters

None.

Returns

string[] - Array of account addresses that the user has authorized.

Example

try {
  const accounts = await provider.request({ method: 'eth_requestAccounts' });
  console.log('Connected as:', accounts[0]);
} catch (error) {
  if (error.message.includes('cancelled')) {
    console.log('User cancelled the connection');
  }
}

Behavior

  1. If the user is already connected, returns the stored account immediately
  2. If not connected, opens the lightweight connect modal
  3. If the user has never authenticated, shows the full auth modal with passkey registration/login
  4. The user can approve or cancel the connection request

Notes

  • This is the standard way to request wallet connection
  • Equivalent to calling wallet_connect
  • The returned address is the user's smart account address