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 Unity application's specific requirements.
Configuration structure
Pass a Web3AuthOptions instance to setOptions when you initialize the SDK:
web3Auth = GetComponent<Web3Auth>();
web3Auth.setOptions(new Web3AuthOptions(){
clientId = "<YOUR_CLIENT_ID>",
web3AuthNetwork = Web3Auth.Network.SAPPHIRE_MAINNET,
redirectUrl = new Uri("<YOUR_SCHEME>://<YOUR_APP_PACKAGE_NAME>/auth"),
});
Web3AuthOptions
The setOptions method takes a Web3AuthOptions instance.
- Table
- Class
| Parameter | Description |
|---|---|
clientId | Client ID from the MetaMask Developer dashboard. |
web3AuthNetwork | Sapphire network. Use SAPPHIRE_DEVNET for testing and SAPPHIRE_MAINNET for production. |
redirectUrl | URL that receives the authentication response. It must match the dashboard and deep-link settings. |
authConnectionConfig? | Custom authentication connections as a List<AuthConnectionConfig>. |
whiteLabel? | Branding and localization settings as WhiteLabelData. |
walletServicesConfig? | Wallet Services confirmation and branding settings as WalletServicesConfig. |
defaultChainId? | Initial Wallet Services chain ID. The default is 0x1. |
mfaSettings? | MFA factor settings as MfaSettings. |
sessionTime? | Session duration in seconds. The default is 86,400 seconds. |
enableLogging? | Whether SDK logging is enabled. The default is false. |
public class Web3AuthOptions
{
public string clientId { get; set; }
public Uri redirectUrl { get; set; }
public Web3Auth.Network web3AuthNetwork { get; set; }
public List<AuthConnectionConfig> authConnectionConfig { get; set; }
public WhiteLabelData whiteLabel { get; set; }
public WalletServicesConfig walletServicesConfig { get; set; }
public string defaultChainId { get; set; } = "0x1";
public MfaSettings mfaSettings { get; set; }
public int sessionTime { get; set; } = 86400;
public bool enableLogging { get; set; } = false;
}
Session management
Control how long users stay authenticated and how sessions persist in Unity.
Key Configuration Options:
sessionTime- Session duration in seconds. Controls how long users remain authenticated before they must sign in again.- Minimum: 1 second (
1). - Maximum: 30 days (
86400 * 30). - Default: 1 day (
86400).
- Minimum: 1 second (
web3Auth.setOptions(new Web3AuthOptions(){
clientId = "<YOUR_CLIENT_ID>",
web3AuthNetwork = Web3Auth.Network.SAPPHIRE_MAINNET,
sessionTime = 86400 * 7, // 7 days (in seconds)
redirectUrl = new Uri("<YOUR_SCHEME>://<YOUR_APP_PACKAGE_NAME>/auth"),
});
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 Embedded Wallets login screens to match your Unity 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. For detailed configuration options and implementation examples, see the Multi-Factor Authentication section.
Key Configuration Options:
mfaSettings- Configure MFA settings for different authentication flowsmfaLevel- Control when users are prompted to set up MFA
Dapp share
Share authentication sessions across different applications. For detailed configuration options and implementation examples, see the dapp share section.