Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/409.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Auth0:如何向UserObject添加自定义属性?_Javascript_Reactjs_Mongodb_Auth0 - Fatal编程技术网

Javascript Auth0:如何向UserObject添加自定义属性?

Javascript Auth0:如何向UserObject添加自定义属性?,javascript,reactjs,mongodb,auth0,Javascript,Reactjs,Mongodb,Auth0,亲爱的StackOverFlow社区大家好, 我对Auth0了解不多,需要帮助。我想知道在创建用户时如何添加我自己的属性?仅供参考,我已将Auth0连接到我自己的MongoDB atlas数据库 我想在创建用户时添加一个customId,这应该是一个16位随机数 我的userObj应该是这样的: { _id: ObjectId("5f720126054c87001662a138"), connection:"MongoDB" client_id:"

亲爱的StackOverFlow社区大家好, 我对Auth0了解不多,需要帮助。我想知道在创建用户时如何添加我自己的属性?仅供参考,我已将Auth0连接到我自己的MongoDB atlas数据库

我想在创建用户时添加一个customId,这应该是一个16位随机数

我的userObj应该是这样的:

{
_id: ObjectId("5f720126054c87001662a138"),
connection:"MongoDB"
client_id:"zoClZ3gZE56iwblHXQ1vgwEcLfYr81Bx"
email:"gustek@gustek.com"
username:"gustek"
password:"$2b$10$dE69gGsDqVfWtmnXZ6EaKetILUmEju8N9PVjtDpgzzAp4jYNQbe8G"
tenant:"dev-test"
email_verified:false
customId:"9829539769841530"
}
{
    client_id: "<ID of creating client (application)>",
    tenant: "<name of creating Auth0 tenant>",
    email: "<email address for the user>",
    password: "<password for the user>",
    username: "<name associated with the user>",
    user_metadata: {
        "language": "en"
    },
    app_metadata: {
        "custom_id": "1234567890"
    }
}
我的意思是,我在文档中发现了一些东西,但我不知道如何实现它:

我必须在这个表面上做吗


正如我之前所说,我不知道如何才能做到这一点。我感谢你的每一个回答

您可以在用户对象中使用
app\u metadata
属性来存储不属于规范化用户配置文件的数据。这将包括您在这里描述的自定义UUID

用户对象将如下所示:

{
_id: ObjectId("5f720126054c87001662a138"),
connection:"MongoDB"
client_id:"zoClZ3gZE56iwblHXQ1vgwEcLfYr81Bx"
email:"gustek@gustek.com"
username:"gustek"
password:"$2b$10$dE69gGsDqVfWtmnXZ6EaKetILUmEju8N9PVjtDpgzzAp4jYNQbe8G"
tenant:"dev-test"
email_verified:false
customId:"9829539769841530"
}
{
    client_id: "<ID of creating client (application)>",
    tenant: "<name of creating Auth0 tenant>",
    email: "<email address for the user>",
    password: "<password for the user>",
    username: "<name associated with the user>",
    user_metadata: {
        "language": "en"
    },
    app_metadata: {
        "custom_id": "1234567890"
    }
}
{
客户端id:“”,
承租人:“,
电邮:“,
密码:“”,
用户名:“”,
用户单元元数据:{
“语言”:“en”
},
应用程序单元元数据:{
“自定义id”:“1234567890”
}
}

虽然
user\u metadata
app\u metadata
是可选的,但如果提供,它们不需要存储在旧身份存储中;Auth0自动将这些值存储为内部创建的用户配置文件记录的一部分。这些值(可选)作为参考提供:它们的内容可能会对传统身份创建产生影响。

感谢您的回复Dan Woda!如果您能回答我以下问题,我将非常高兴: