Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid Firebase path: .com. Firebase paths must not contain '.', '#', '$', '[', or ']' [closed]

I'm going to save the email and password in a Firebase database, but unfortunately I got this error.

Invalid Firebase path: .com. Firebase paths must not contain '.', '#', '$', '[', or ']'

enter image description here

like image 623
Mati Ullah Zahir Avatar asked Dec 10 '16 14:12

Mati Ullah Zahir


1 Answers

As could be noticed from the error, Firebase path(key) doesn't allow certain special characters in the path.
While storing email as path, I recommend you to encode the email i.e., replace 'dots' from 'commas'. If you wan't to retrieve, you can decode.

public static String EncodeString(String string) {
    return string.replace(".", ",");
}

public static String DecodeString(String string) {
    return string.replace(",", ".");
}

Let me know, how it goes for you.

Update

Using UIDs to store user details is better than Email IDs.

like image 124
Nishanth Sreedhara Avatar answered Nov 01 '22 14:11

Nishanth Sreedhara