Connecting to Phantom Wallets
After instantiating the SDK, usesdk.connect() to establish a connection to the wallet and access chain-specific operations.
Learn about Phantom Connect: For details about authentication flows, OAuth login, extension login, account selection, and session management, see the Phantom Connect guide.
Basic Connection
User Wallet Connection
Authentication Providers
Theconnect() method accepts a provider parameter to specify how users should authenticate:
Connecting with Phantom Extension (Embedded Wallet)
The"phantom" provider option allows users to authenticate an embedded wallet using their existing Phantom browser extension. Before using this option, check if Phantom login is available:
- Faster authentication for existing Phantom users
- No need to create a new account
- Familiar Phantom interface
- Same security and permission controls
Connecting to Injected Extension
The"injected" provider directly connects to the user’s Phantom browser extension (not an embedded wallet). Before using this option, check if the extension is installed:
- User wants to use their existing extension wallet directly
- No embedded wallet creation needed
- Direct access to extension accounts and balances
Configuration Options
Important notes aboutredirectUrl (for embedded provider):
- Must be an existing page/route in your application
- Must be whitelisted in your Phantom Portal app configuration
- This is where users will be redirected after completing OAuth authentication