Android Firebase Database Invalid Token In Path
I did the base64 utf-8 encoding of the email. Because it is a database key. However, the following problems arise. I need help. setValue at /user/aW1hZ2VfNTk1NkBuYXZlci5jb20= faile
Solution 1:
In my case, the encoded string was having a new line at the end. Using Base64.NO_WRAP
as mentioned by @Arvin in this answer worked as a solution. My encoding function now looks like:
publicstaticStringencodeToBase64(String strToEncode) {
byte[] data = null;
try {
data = strToEncode.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
returnBase64.encodeToString(data, Base64.NO_WRAP);
}
If you're aiming to be safe like what @BobSnyder mentioned in the comments above, you could still use URL_SAFE
and just trim the String just to make sure.
Post a Comment for "Android Firebase Database Invalid Token In Path"