In the “Update a connection” documentation
I found that there is a customScripts section in the BODY PARAMETERS section, where change_username and change_phone_number are present.
I believe it’s now possible to write change_username and change_phone_number as scripts for a Custom Database Connection.
Please tell me the arguments for these functions.
There is documentation for change_email.
However, there is no documentation for change_username or change_phone_number.
Hi @yasuyuki.kobayashi
Welcome to the Auth0 Community!
Thank you for bringing this to our attention! While the change_username
and change_phone_number
scripts are not mentioned in our documentations, let me try and provide some information :
change_username
: it should function the same way as the change_email
script, as it ends with return(null, true) when successful. The script must also be added in the list of action scripts via the Management API :
"change_username": "function changeUsername(oldUsername, newUsername, callback) { console.log("ChangeUsername called")
callback(null, true);}"
change_phone_number
: this script needs to be implemented in order to update the phone number in the external DB through the Management API, as the Auth0 Dashboard does not support it:
{
"options": {
"customScripts": {
"change_phone_number": "function changePhoneNumber(oldPhoneNumber, newPhoneNumber, verified, callback) { console.log(\"Update phone number called....\"); console.log (\"oldPhoneNumber:\", oldPhoneNumber); console.log (\"newPhoneNumber:\", newPhoneNumber); console.log (\"verified:\", verified); console.log (\"callback:\", callback); callback(null, true); \n}\n",
// other scripts are removed for brevity
},
// other attributes are removed for brevity
}
}
Useful documentation:
Hope this helped!
Gerald
1 Like