true, ".validate": "newData.isString() && newData.val().length < 100" } } Three basic rules .read → if and when data is allowed to be read by users. .write → if and when data is allowed to be written. .validate → Defines what a correctly formatted value. GDG Cáceres
"timestamp": 1405704370369 }, "message1": { "content": "Goodbye", "timestamp": 1405704395231 }, ... } } { "rules": { "messages": { "$message": { // only messages from the last ten minutes can be read ".read": "data.child('timestamp').val() > (now - 600000)", // new messages must have a string content and a number timestamp ".validate": "newData.hasChildren(['content', 'timestamp'])" } } } } GDG Cáceres
new Firebase.AuthResultHandler() { @Override public void onAuthenticated(AuthData authData) {} @Override public void onAuthenticationError(FirebaseError firebaseError) {} }; // Authenticate users with a custom Firebase token ref.authWithCustomToken("<token>", authResultHandler); // Alternatively, authenticate users anonymously ref.authAnonymously(authResultHandler); // Or with an email/password combination ref.authWithPassword("[email protected]", "correcthorsebatterystaple", authResultHandler); // Or via popular OAuth providers ("facebook", "github", "google", or "twitter") ref.authWithOAuthToken("<provider>", "<oauth-token>", authResultHandler); GDG Cáceres