colyseus / colyseus-haxe

⚔ Colyseus Multiplayer SDK for Haxe
https://docs.colyseus.io/getting-started/haxe-client/
MIT License
75 stars 16 forks source link

Auth API #57

Closed endel closed 9 months ago

endel commented 9 months ago

Overview for Auth API:

Define callback for Auth state change:

client.auth.onChange(function (authData) {
    if (authData.user != null) {
        // logged in!
    } else {
        // logged out!
    }
});

Methods:

Example

client.auth.signInWithEmailAndPassword("endel@colyseus.io", "123456", function(err, authData) {
    if (err != null) {
      trace(err);
    } else {
      trace("TOKEN => " + authData.token);
      trace("USER => " + authData.user);
    }
})