For AI agents: a documentation index is available at /llms.txt. A markdown version of this page is available at the same URL with .md appended (or via Accept: text/markdown).
Skip to main content

Advanced configuration

The Embedded Wallets SDK provides extensive configuration options that allow you to customize authentication flows, UI appearance, blockchain integrations, and security features to meet your application's specific requirements.

Configuration structure

When setting up Embedded Wallets, you'll pass in the options to the constructor. This consists of:

import 'package:web3auth_flutter/web3auth_flutter.dart';
import 'package:web3auth_flutter/enums.dart';
import 'package:web3auth_flutter/input.dart';
import 'package:web3auth_flutter/output.dart';
import 'dart:io';

Future<void> initWeb3Auth() async {

late final String redirectUrl;

if (Platform.isAndroid) {
redirectUrl = 'w3a://com.example.w3aflutter';
} else {
redirectUrl = 'com.example.w3aflutter://auth';
}


await Web3AuthFlutter.init(Web3AuthOptions(
clientId: "YOUR_WEB3AUTH_CLIENT_ID", // Pass your Web3Auth Client ID, ideally using an environment variable // Get your Client ID from MetaMask Developer Dashboard dashboard
web3AuthNetwork: Web3AuthNetwork.sapphire_mainnet, // or Web3AuthNetwork.sapphire_devnet
redirectUrl: redirectUrl,
));

}

Web3AuthOptions

The Web3Auth Constructor takes an object with Web3AuthOptions as input.

ParameterDescription
clientIdYour Web3Auth Client ID from the Dashboard. Mandatory String.
web3AuthNetworkWeb3Auth Network: sapphire_mainnet, sapphire_devnet, mainnet, cyan, aqua, or testnet. Mandatory Web3AuthNetwork.
redirectUrlURL that Web3Auth redirects to after successful authentication. Mandatory String.
whiteLabel?Whitelabel options for custom UI, branding, and translations. Takes WhiteLabelData as a value.
authConnectionConfig?Auth connection config for custom connections. Takes List<AuthConnectionConfig> as a value.
chains?Chain configuration for Wallet Services and signing. Takes List<Chains> as a value.
defaultChainId?Default chain ID from the chains list.
mfaSettings?Configure MFA settings for authentication. Takes MfaSettings as a value.
sessionTime?Configure session management time in seconds. Default is 30 days. Max 30 days.

Session management

Control how long users stay authenticated and how sessions persist. The session key is stored in the device's encrypted Keystore.

Key Configuration Options:

  • sessionTime - Session duration in seconds. Controls how long users remain authenticated before needing to log in again.
    • Minimum: 1 second (1).
    • Maximum: 30 days (86400 * 30).
    • Default: 30 days (30 * 86400).
await Web3AuthFlutter.init(Web3AuthOptions(
clientId: "YOUR_WEB3AUTH_CLIENT_ID", // Pass your Web3Auth Client ID, ideally using an environment variable // Get your Client ID from MetaMask Developer Dashboard dashboard
web3AuthNetwork: Web3AuthNetwork.sapphire_mainnet, // or Web3AuthNetwork.sapphire_devnet
sessionTime: 30 * 86400, // 30 days (in seconds)
redirectUrl: redirectUrl,
));

Custom authentication methods

Control the login options presented to your users. For detailed configuration options and implementation examples, see the custom authentication section.

UI customization

Customize the brand experience by customizing the Web3Auth Login Screens to match your application's design. For complete customization options, refer to the whitelabeling and UI customization section.

Multi-Factor Authentication (MFA)

Add additional security layers to protect user accounts with two-factor authentication. See the detailed configuration options and implementation examples.

Key Configuration Options:

  • mfaSettings - Configure MFA settings for different authentication flows
  • mfaLevel - Control when users are prompted to set up MFA