magicblock-labs / Solana.Unity-SDK

Open-Source Unity-Solana SDK with Full RPC coverage, NFT support and more
https://solana.unity-sdk.gg
MIT License
157 stars 89 forks source link

:sparkles: Expose Web3Auth user info #185

Closed GabrielePicco closed 1 year ago

GabrielePicco commented 1 year ago

Expose Web3Auth user info

Status Type ⚠️ Core Change Issue
Ready Feature No -

Problem

Web3Auth UserInfo were not exposed after the login

Solution

Added a public userInfo field that can be accessed after the login:

As a simple example, a script can register to the OnLogin event and print the user email, if available.

public void Start()
{
    Web3.OnLogin += OnLogin;
}

private void OnLogin(Account obj)
{
    if(Web3.Wallet is Web3AuthWallet) Debug.Log(((Web3AuthWallet)Web3.Wallet).userInfo?.email);
}