💻 Tech
Importing users can be programatically done with go package go-auth0
, especially if you want to create users without password. However, you may enocunter this error:
"errors": [
{
"code": "OBJECT_MISSING_REQUIRED_PROPERTY",
"message": "Requires at least one of the following identifiers: email, phone_number, username"
}
]
The error is because those values weren’t provided because the slice of map of users weren’t provided correctly like so:
job := &management.Job{
Users: []map[string]interface{}{
{
*user.Email: user,
},
},
ConnectionID: &connectionId,
Upsert: &bTrue,
SendCompletionEmail: &bTrue,
}
However, Users
are slice of maps of users. A map of user consists of properties of a user:
job := &management.Job{
Users: []map[string]interface{}{
user,
},
ConnectionID: &connectionId,
Upsert: &bTrue,
SendCompletionEmail: &bTrue,
}