目前我收到错误
Function DocumentReference.set() called with invalid data. Unsupported field value: a custom Object object (found in field Password)
这是我的代码
const inputPasswordField = document.querySelector("#pwrd");
var encrypted = CryptoJS.AES.encrypt(inputPasswordField.value, "Secret");
const PasswordSave = encrypted;
docRef.add({
Password: PasswordSave,
}).then(function(){
console.log("status saved!");
}).catch(function(error){
console.log("got an error",error);
})
最佳答案
CryptoJS.AES.encrypt
创建一个包含加密数据的对象。
像这样声明PasswordSave
:
const PasswordSave = encrypted.toString();
关于javascript - 如何将此自定义对象添加到 firebase,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52715973/