gpt4 book ai didi

javascript - 如何将此自定义对象添加到 firebase

转载 作者:行者123 更新时间:2023-12-01 01:37:13 25 4
gpt4 key购买 nike

目前我收到错误

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com