Social Login Functionality with SocialLoginClient
With the SocialLoginClient
class, you can integrate Log in with Google, Facebook, or Twitter into your application.
SocialLoginClient
The social login client represents a user who has logged in via one of the supported social login methods. It has methods that can sign messages and send transactions in a non-custodial manner on behalf of the user.
SocialLoginClientParams
To initialize the SocialLoginClient
, you will need to pass in a set of parameters that specifies the user to be logged in:
/**
* Interface for initializing the SocialLoginClient
* @param hallidayPublicApiKey The Halliday API Key
* @param inGamePlayerId The user's unique in-game player id in your app
* @param blockchainType The blockchain type to use for the user
* @param sandbox Argument to use sandbox or production API. Defaults to false (i.e. prod)
*/
interface SocialLoginClientParams {
hallidayPublicApiKey: string;
inGamePlayerId: string;
blockchainType: BlockchainType;
sandbox: boolean;
}
Log In with Social Login Client
The Social Login Client supports integration with major social providers, including Google, Facebook, and Twitter.
Please refer to the Getting Started Guide to set up your
SocialLoginClient
!
Social Login Client Methods
After the user has logged in, they can user their Halliday Smart Account to easily send transactions on the blockchain, as well as retrieve their information. Below are the functions supported by the SocialLoginClient
:
/**
* Returns the current logged-in player's email
* @returns The logged-in player's email
*/
getPlayerEmail(): string
/**
* Returns the current logged-in player's inGamePlayerId
* @returns The logged-in player's inGamePlayerId
*/
getInGamePlayerId(): string
/**
* Returns the SocialLoginSigner object
* @returns The signer associated with the SocialLoginClient
*/
async getSigner(): Promise<SocialLoginSigner>
/**
* Create or Fetch the Halliday Account Abstraction Wallet associated with the SocialLoginSigner for the player
*
* @returns The Halliday Account Abstraction Wallet
*/
async getOrCreateHallidayAAWallet(): Promise<GetWalletResponse>
Logout
Logout should be called on the SocialLoginClient
when the user completes their active session. To access their Halliday Smart Account again via the SocialLoginClient
, they will need to go through the social login flow again.
/**
* Log out the SocialLoginClient.
*/
logOut(): void
Updated about 2 months ago