I have tried to understand but not able to see how and where might be the data I am storing after login is going.
public static final String BASE_URL = \"https:/
First, modify the Firebase rules as follows:
{
"rules": {
"users": {
"$uid": {
".write": "$uid === auth.uid",
".read": "$uid === auth.uid"
}
}
}
}
Then, in Java Code:
Firebase rootRef = new Firebase("https://user-account.firebaseio.com/");
// Assuming the user is already logged in.
Firebase userRef = rootRef.child("users/" + rootRef.getAuth().getUid());
userRef.child("message1").setValue("Hello World");
In the end, the data would look something like this:
For web end
Javascript code:
var user = firebase.auth().currentUser;
if (user != null) {
uid = user.uid;
firebase.database().ref('/users/'+uid).push({
foo: 'abc',
bar: 'pqr'
});
}
Read https://firebase.google.com/docs/auth/web/manage-users#get_the_currently_signed-in_user for more information.