Upgrade 1.3 🠚 1.4

Before upgrading, back up your project to avoid any data loss.

APIs marked as deprecated on 1.2 and earlier are removed on 1.4. Make sure your project is not using them before upgrading.

AuthClient API changes

We've greatly simplified the AuthClient API which should make it much easier to use and much harder to get wrong.

Part of the changes is moving the responsibility of storing the guest login credentials to the consumer of the AuthClient.

All Login methods return a LoginResult object which contains credentials required for further sign-ins, including the SessionToken which was previously stored in the AuthClient. It is in caller's best interest to store those credentials so they can be reuse in the next session.

Example of a new sign up / sign in flow:

async Task<bool> SignUp(AuthClient authClient, string username, string password)
{
    LoginResult loginResult = await authClient.LoginWithPassword(username, password, autoSignup: true);
    if(loginResult.Type != Result.Success)
    {
        // ... handle failure
        return false;
    }

    // Custom token saving function
    SaveSessionToken(loginResult.SessionToken);
    return true;
}

async Task<bool> SignIn(AuthClient authClient)
{
    // Custom token loading function
    var sessionToken = LoadSessionToken();
    if(sessionToken == null)
    {
        // ... handle failure
        return false;
    }

    LoginResult loginResult = await authClient.LoginWithToken(sessionToken);
    return loginResult.Type == Result.Success;
}

The new AuthClient API looks as follows:

event Action<LoginResponse> OnLogin;
event Action OnLogout;
event Action<LoginError> OnError;

bool LoggedIn { get; }

Task<LoginResult> LoginAsGuest();
Task<LoginResult> LoginWithPassword(string username, string password, bool autoSignup);
Task<LoginResult> LoginWithToken(SessionToken sessionToken);

void Logout();
void Dispose();

Last updated