Setup
Prerequisites
Before you begin, make sure you have set up your Privy app and obtained your app ID and client ID from the Privy Dashboard.
A properly set up app client is required for mobile apps and other non-web platforms to allow your app to interact with the Privy API. Please follow this guide to configure an app client by following this guide here.
Initializing Privy
Initialize Privy as early as possible in your game’s lifecycle by calling PrivyManager.Initialize(PrivyConfig config)
:
Configuration
The configuration fields for the PrivyConfig are:
Be sure to initialize Privy only once at the start of your game. Initializing multiple instances of Privy will result in unexpected errors.
Waiting for Privy to be ready
When the Privy SDK first initializes, the user’s AuthState
will be set to NotReady
until Privy finishes initialization. This might include refreshing a user’s access token, fetching the updated user object, loading the embedded wallet iframe, and more.
It’s important to wait until Privy has finished initializing before you consume Privy’s state and interfaces, to ensure that the state you consume is accurate and not stale.
To determine whether the Privy SDK has fully initialized, you can use the AwaitReady()
function:
You can also check whether Privy is ready at any time by calling:
Was this page helpful?