Login with Custom OIDC Providers

If you already have social login flow, integrating with Halliday's SDK is simple. If your social login client returns an OIDC token from a fully-compliant OpenID Connect Provider, you can use that token to initialize the Social Login Client to access their unique Halliday Smart Account. This page provides a walkthrough for integrating Halliday's custom OIDC token Social Login Client.


Initialize the Halliday SDK SocialLoginClient with your OIDC Token

🚧

Be sure to register your OpenID Connect Provider's client_id with the Halliday Dashboard so your users can perform social login!

Integrating initializeClientWithOidcToken()

The following code example demonstrates an integration for initializeClientWithCustomOidcToken(), which returns a SocialLoginClient with a unique signer associated with the user's OIDC token

🚧

Different Social Login Methods should have different inGamePlayerId's

When a user logs in with a different social login provider (ex. AWS Cognito vs Facebook), they will receive a different signer and Halliday Smart Account. To prevent confusion, it is important that you provide us a unique inGamePlayerId for each type of social login provider, even for the same user.

import { useState } from "react";
import { SocialLoginClient, SocialLoginClientParams } from "halliday-sdk"

async function loginWithHallidayOidc(): Promise<SocialLoginClient> {
  const oidcToken: string = <YOUR_OIDC_TOKEN>;
  const socialLoginParams: SocialLoginClientParams = {
    hallidayPublicApiKey: <YOUR_HALLIDAY_PUBLIC_API_KEY>,
    blockchainType: BlockchainType.MUMBAI,
    sandbox: true
  }
  
  const hallidayClient = await SocialLoginClient.initializeClientWithCustomOidcToken(oidcToken, socialLoginParams);
  
  return hallidayClient;
}

Once the client is initialized, you will be able to send transactions with your Halliday Smart Account, and have access to all of our other amazing Halliday Smart Account features (including session keys and more)!

Log Out of SocialLoginClient

Before your user logs out of your application, it is important to log them out of the SocialLoginClient as well to clear any session data. You can log out of the client by calling the client.logout() function.