User Authentication
The PlayAI SDK requires user authentication for its operation. The process of getting a session token for the user is facilitated through the API key and game ID provided to the game. It is imperative to note that this operation should be executed on the game's backend servers to prevent exposure of the API key on the client side.
The type
field in the request body can be one of the following: google
, twitter
, evm
, or solana
. The account
field should contain the user's account details.
The account
field is a string that represents the user's account details. For Google and Twitter, it can be the user's email or username respectively. For EVM and Solana, it should be the user's wallet address
Here's an example of how you can get a session token on your server:
Once the session token is obtained, it can be used on the client side to authenticate the user with the PlayAI SDK:
The authentication process should start by calling the getCurrentSession
method, which returns the session details. If the user is not authenticated, getCurrentSession
will return null
.
Here's an example of how you can use the session token to authenticate the user:
Last updated