I tried to specify both username and email and I got this error:
{
statusCode: 400,
exception: {
fieldErrors: {
'user.email': [
{
code: '[blank]user.email',
message: 'You must specify either the [user.email] or [user.username] property. If you are emailing the user you must specify the [user.email].'
}
],
'user.username': [
{
code: '[blank]user.username',
message: 'You must specify either the [user.email] or [user.username] property. If you are emailing the user you must specify the [user.email].'
}
]
},
generalErrors: []
}
}
So basically I guess my best bet is to manually enforce uniqueness of username in my backend. But it could have been less cumbersome if I could delegate it to FusionAuth.
I guess what I am trying to emphasis here is the fact that just by saving username in user.data we will be able to have both username and email but applying rules such as uniqueness would require more manual labor. Cannot we just tell FusionAuth to make sure that user.data.username should be unique in that app or tenant?
Side note: Since my question is deviating from the OP I'll create a new post and reference this one.