InAppWallet

InAppWallet is the ultimate persistent wallet provider option for your game. It supports email, phone, social and custom authentication schemes, and will persist across devices, platforms, and other SDKs.

It makes for a fantastic SmartWallet admin/signer and will make sure your users can have the same wallet address across all your games, apps and blockchains.

Login Methods

In-App Wallets support a variety of login methods:

  • Email (OTP Login)
  • Phone (OTP Login)
  • Socials (Google, Apple, Facebook, Telegram, Farcaster, Line, Github, Twitch, Steam, etc.)
  • SIWE (Sign-In with Ethereum)
  • Custom Auth (OIDC Compatible)
  • Custom Auth (Generic Auth Endpoint)
  • Guest (Onboard easily, link other accounts later)

Login with Email

var inAppWalletOptions = new InAppWalletOptions(email: "myepicemail@domain.id");
var options = new WalletOptions(
provider: WalletProvider.InAppWallet,
chainId: 1,
inAppWalletOptions: inAppWalletOptions
);
var wallet = await ThirdwebManager.Instance.ConnectWallet(options);

Will instantiate InAppWalletModal or resume the session - a simple prefab that will verify the user OTP.

Login with Phone

var inAppWalletOptions = new InAppWalletOptions(phoneNumber: "+1234567890");
var options = new WalletOptions(
provider: WalletProvider.InAppWallet,
chainId: 1,
inAppWalletOptions: inAppWalletOptions
);
var wallet = await ThirdwebManager.Instance.ConnectWallet(options);

Will instantiate InAppWalletModal or resume the session - a simple prefab that will verify the user OTP.

Login with Socials (Google, Apple, Facebook, etc.)

var inAppWalletOptions = new InAppWalletOptions(authprovider: AuthProvider.Google);
var options = new WalletOptions(
provider: WalletProvider.InAppWallet,
chainId: 1,
inAppWalletOptions: inAppWalletOptions
);
var wallet = await ThirdwebManager.Instance.ConnectWallet(options);

Will open a native browser or oauth session to authenticate the user and redirect back to the game.

Login with SIWE

var inAppWalletOptions = new InAppWalletOptions(authprovider: AuthProvider.Siwe, siweSigner: anyExternalWallet);
var options = new WalletOptions(
provider: WalletProvider.InAppWallet,
chainId: 1,
inAppWalletOptions: inAppWalletOptions
);
var wallet = await ThirdwebManager.Instance.ConnectWallet(options);

Will use the external wallet to sign a message and login to the InAppWallet.

Login with Custom Auth - OIDC Compatible

var inAppWalletOptions = new InAppWalletOptions(authprovider: AuthProvider.JWT, jwtOrPayload: "myjwt", encryptionKey: "myencryptionkey");
var options = new WalletOptions(
provider: WalletProvider.InAppWallet,
chainId: 1,
inAppWalletOptions: inAppWalletOptions
);
var wallet = await ThirdwebManager.Instance.ConnectWallet(options);

Login with Custom Auth - Generic Auth Endpoint

var inAppWalletOptions = new InAppWalletOptions(
authprovider: AuthProvider.AuthEndpoint,
jwtOrPayload: "mypayload",
encryptionKey: "myencryptionkey"
);
var options = new WalletOptions(
provider: WalletProvider.InAppWallet,
chainId: 1,
inAppWalletOptions: inAppWalletOptions
);
var wallet = await ThirdwebManager.Instance.ConnectWallet(options);
var inAppWalletOptions = new InAppWalletOptions(
authprovider: AuthProvider.Guest
);
var options = new WalletOptions(
provider: WalletProvider.EcosystemWallet,
chainId: 1,
inAppWalletOptions: inAppWalletOptions
);
var wallet = await ThirdwebManager.Instance.ConnectWallet(options);

Account Linking

InAppWallets support linking multiple authentication methods to a single wallet, for instance linking Google to your Email-based In-App-Wallet. This is useful to have a unified identity across platforms.

// Your main InAppWallet account, already authenticated and connected
InAppWallet mainInAppWallet = ...
// An InAppWallet with a new auth provider to be linked to the main account, not connected
InAppWallet walletToLink = await InAppWallet.Create(client: Client, authProvider: AuthProvider.Telegram);
// Link Account - Headless version
var linkedAccounts = await mainInAppWallet.LinkAccount(walletToLink: walletToLink);
// Link Account - Unity wrapper version
var linkedAccounts = await ThirdwebManager.Instance.LinkAccount(mainInAppWallet, walletToLink);
// You can also fetch linked accounts at any time
List<LinkedAccount> linkedAccounts = await mainInAppWallet.GetLinkedAccounts();

Learn more about InAppWallet