Overview
Para supports authentication with external wallets, allowing users to connect their existing MetaMask, Phantom, or other wallets to authenticate with your Flutter application. To sign users in to Para with their wallet, useauthenticateWithExternalWallet. The Flutter SDK maintains blockchain packages (web3dart, solana_web3) to provide direct access to external wallet functionality while integrating with Para’s unified wallet architecture.
This guide covers how to implement external wallet authentication and interaction using Para’s connector classes.
Prerequisites
Before implementing external wallet support, ensure you have:- Para SDK set up in your Flutter project (see the Setup Guide)
- Deep linking configured for your app
- Target external wallet apps installed on the device
Deep Link Configuration
External wallet authentication requires deep linking to redirect users back to your app after wallet interaction. Configure this in both iOS and Android.Android Configuration
Add an intent filter to yourandroid/app/src/main/AndroidManifest.xml:
iOS Configuration
Add your URL scheme toios/Runner/Info.plist:
External Wallet Authentication with Para
Para supports signing in with an external wallet like MetaMask, so users can log into Para with the wallet they already have.Connection-only vs. sign-in
There are two ways to tell Para about an external wallet:- Connection-only. Para records the connected address for the session without signing the user in to a Para account.
- Sign-in (
authenticateWithExternalWallet, recommended). The user signs in to a Para account with the wallet. On Para’s updated authentication flow, the wallet proves it controls the address by signing a sign-in message. This is a verify-only sign-in: Para doesn’t create an embedded Para wallet for the user, and the external wallet stays the user’s wallet.
Sign In with authenticateWithExternalWallet (Recommended)
Call authenticateWithExternalWallet with the wallet’s address and chain type and a signMessage callback that signs a message with that wallet and returns the signature. For a Cosmos wallet, also pass signCosmosMessage. It returns an AuthenticationResult with the user’s userId and whether this sign-in created the account (isNewUser).
- Para’s updated authentication flow. The SDK asks your
signMessagecallback to sign a sign-in message (a Sign-In With Ethereum message for EVM wallets), then verifies the signature, and the user is signed in right away. This is the same for new and returning accounts: no passkey, password, or Para-hosted page is involved, and no embedded Para wallet is created. The session proves control of the external wallet only, so it can’t sign with any embedded Para wallets the account already has. - Address sign-in without a signature. The SDK signs in with the wallet address, the same way
loginExternalWalletdoes, andsignMessageisn’t called.
- EVM (
WalletType.evm):signMessagereturns the wallet’s signature over the message, for MetaMaskmetaMaskConnector.signMessage(message, address). - Solana (
WalletType.solana):signMessagereturns the base58-encoded signature, for PhantomphantomConnector.signMessage(message). - Cosmos (
WalletType.cosmos): passsignCosmosMessage, which returns aCosmosSignedMessagewith the signature, the signer’s address, and its public key. Para needs all three to verify the signature, so the call throwsmissing_cosmos_signerwithout it.signMessageis still required but isn’t called for Cosmos.
connect() (such as ParaMetaMaskConnector.connect() or ParaPhantomConnector.connect()) signs in with the connected address, without a signature, the same way loginExternalWallet does. If your app uses connection-only external wallets, it records a connection-only session instead. Because it signs in, connect() can throw a ParaBridgeException with code two_factor_required when the account must complete login 2FA, which this sign-in can’t host.
If a session from an earlier wallet connect is active, authenticateWithExternalWallet logs it out before signing in, on both flows, so you can connect first and then sign in.
lib/views/external_wallet_login.dart
signMessageswitches apps. For MetaMask,signMessage(message, account)opens MetaMask to approve the signature and returns when MetaMask hands back to your app, so your deep link configuration must be in place. Throw fromsignMessageto cancel sign-in.- The message names a domain. The sign-in message names the URI in
uri:, and its domain is what the wallet shows the user. When you omituri:, it names Para’s origin. Pass your own URI (for example'https://yourapp.com') to show your domain instead. chainIdis optional. Pass the chain the wallet is on, for examplemetaMaskConnector.chainId. For EVM wallets the message defaults to Ethereum mainnet.- A new user has no embedded Para wallet. A verify-only sign-in creates no Para wallet shares. Sign transactions with the external wallet, for example
metaMaskConnector.sendTransaction(...).
On Para’s updated authentication flow,
authenticateWithExternalWallet throws if a user is already signed in to a Para account (already_authenticated). Call logout() first. A connection-only session, or the address-only session from a connector’s connect() or loginExternalWallet, doesn’t count: the SDK logs it out for you.Manual Alternative: loginExternalWallet
loginExternalWallet(externalAddress:, type:) keeps working unchanged. It signs in with the wallet address without asking the wallet for a signature and doesn’t use Para’s updated authentication flow, so new integrations should prefer authenticateWithExternalWallet.
Working with Specific Wallets
Para provides dedicated connectors for popular external wallets:MetaMask Integration
Para includes a MetaMask connector for EVM interactions:Phantom Integration
Para includes a Phantom connector for Solana interactions:Example: Complete External Wallet Flow
Here’s a complete example showing external wallet authentication and usage:Security Considerations
When working with external wallets:- Validate Connections: Always verify the wallet connection before performing operations
- Handle Errors Gracefully: External wallet apps may not be installed or might reject connections
- User Experience: Provide clear instructions for users on wallet installation and connection
- Permissions: Ensure your app requests appropriate permissions for wallet interactions
- Deep Link Security: Validate deep link callbacks to prevent malicious redirects
Troubleshooting
Common issues and solutions:Connection Failures
Phantom Transaction Errors
When working with Phantom, use the transaction helper for proper encoding:Wallet App Not Installed
Network Issues
Ensure you have the correct network selected in your external wallet:- Phantom: Check that you’re on the intended Solana network (mainnet-beta, devnet, testnet)
- MetaMask: Verify you’re connected to the correct Ethereum network
- Transactions: Use testnet/devnet for development to avoid spending real funds
Key Features
Para’s Flutter SDK provides:- Unified Architecture: External wallets integrate seamlessly with Para’s unified wallet system
- Direct Blockchain Access: Uses web3dart for Ethereum and solana_web3 for Solana interactions
- Deep Link Support: Handles wallet app redirections automatically
- Transaction Helpers: Utility classes for transaction encoding/decoding
- Error Handling: Comprehensive error handling for wallet interactions