0.15.3
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:
client.auth.getUserData()
client.auth.registerWithEmailAndPassword()
client.auth.signInWithEmailAndPassword()
client.auth.signInAnonymously()
client.auth.sendPasswordResetEmail()
client.auth.signOut()
- (❌ OAuth not yet implemented)
client.auth.signInWithProvider()
Example
client.auth.signInWithEmailAndPassword("[email protected]", "123456", function(err, authData) {
if (err != null) {
trace(err);
} else {
trace("TOKEN => " + authData.token);
trace("USER => " + authData.user);
}
})