MetaMask
eth_requestAccounts
Summary: Requests that the user provide access to addresses.
Requests that the user provide access to one or more Ethereum addresses. This method is specified by EIP-1102. Internally, this method calls
wallet_requestPermissions
for permission to call eth_accounts
.
Parameters
This method doesn't accept any parameters.
Returns
Address list
arrayAn array of Ethereum addresses that the user has authorized the dapp to access.
Errors
Code
Message
4001
User rejected the request.
Customize request
Parameter
Value
Connect your MetaMask wallet to run requests successfully.
Request
await window.ethereum.request({
"method": "eth_requestAccounts",
"params": [],
});
Example response
[
"0xa77392123a1085f75e62eec7dea7e0e1e5142d5f"
]