DocumentationLog In

Connecting accounts


To establish a connection to a user's account, call the connect method on the provider.

try {
    await window.coinbaseSolana.connect();
} catch (err) {
    // { method: 'connect', message: 'Connection error' }

If the user accepts the request and the connection is successful, the publicKey field is set to the PublicKey of the connected account, and the isConnected field is set to true.

// J7VKAb39Vgxar55cFtzLu8QJ2dwS9MrV7NyQJoUK1yDa 
// true

If the user rejects the request to connect, an error is thrown.


To disconnect a user's account from your application, call the disconnect method on the provider.

await window.coinbaseSolana.disconnect();

If the user’s account is disconnected, the publicKey field is set to null, and the isConnected field is set to false.

What’s Next