Customize the authorization caching layer used by MobileWalletProvider to persist wallet connections across app sessions.
This guide is for advanced users who want to customize how wallet authorization details are cached and persisted.
If you’re using MobileWalletProvider with the default settings, authorization caching is already handled for you with AsyncStorage.
When a user authorizes your dApp with their wallet via MWA, the session returns an auth_token and account details. By caching these details, your app can stay “connected” across app restarts without prompting the user to re-authorize every time.The MobileWalletProvider from @wallet-ui/react-native-web3js handles this automatically with a built-in AsyncStorage cache. You can swap in your own cache implementation (e.g for encrypted storage) by passing a custom cache prop.
By default, MobileWalletProvider uses @react-native-async-storage/async-storage to persist authorization data. You don’t need to configure anything for this to work:
If you want to store authorization details in encrypted storage (e.g for sensitive auth tokens), you can create a custom cache using expo-secure-store.
Manual caching with @solana-mobile/mobile-wallet-adapter-protocol-web3js
If you’re using the lower-level @solana-mobile/mobile-wallet-adapter-protocol-web3js library directly (without MobileWalletProvider), you’ll need to manage authorization caching yourself.