Skip to main content

Overview

The authentication flow involving an External Communicator and Wallet typically follows a consistent pattern. Below is a structured outline of the process.

Initialization Flow

During App Initialization:

  1. Find closet region that will be used to connect to Elympics.
  • If exception occures, fallback region will be used. U can set fallback region here: Fallback Region
  1. Request Authentication from External Communicator:
  • If authentication is available, utilize it.
  1. Fallback to Wallet Authentication:
  • If External Communicator authentication is not available, attempt to authorize using the wallet, provided the Capabilities allow it.
  1. Guest Authorization:
  • If neither External Communicator authentication nor wallet authentication is available, authorize the user as a guest.

Runtime Flow

During game lifetime:

  1. Monitor Wallet Connection Status:
  • Continuously listen for changes in the wallet connection status and respond accordingly.

SessionManager Class

To assist developers in managing this repetitive flow, the SessionManager class is provided. It includes the following public methods:

AuthenticateFromExternalAndConnect()

Use this method once per application lifetime. It will:

  • Connect to the external authorizer and attempt to authorize the user automatically.
  • If external authorization fails, it will try to authorize with the wallet.
  • If both external and wallet authorizations fail, it will attempt to authenticate the user as a guest.

ConnectToWallet()

Use this method on UI buttons if you want to initiate the wallet connection flow from the game UI. If this method fails to authenticate with the wallet for any reason, it will automatically try to authorize as a guest.

TryReAuthorizeIfWalletChanged()

Call this method each time the user returns from the gameplay scene to the main menu. It checks if the user has changed their wallet connection status via the PlayPad.