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

eth_accounts

Returns the list of accounts that the user has previously connected. This allows your dApp to check if a user is already connected on page load without prompting them to authenticate again. Unlike eth_requestAccounts, this method never shows a modal.

Try it

Parameters

None.

Returns

string[] - Array of account addresses. Returns an empty array if not connected.

Example

const accounts = await provider.request({ method: 'eth_accounts' });
 
if (accounts.length > 0) {
  console.log('Connected as:', accounts[0]);
} else {
  console.log('Not connected');
}

Notes

  • Returns addresses from localStorage if the user has previously connected
  • Does not prompt the user to connect - use eth_requestAccounts for that
  • Always returns an array (empty if not connected)