The PUT /u/{username}.json endpoint does not change a user’s email address, despite the Discourse API Docs suggesting it should. Canapin pointed out that changing the email address actually uses the /u/{username}/preferences/email.json endpoint, which sends a confirmation link to the email address that must be manually approved by the user.
xbd pointed out that this can be problematic when using a custom-made auth server that handles email confirmation, as it can result in multiple confirmation emails and different datasets. JammyDodger suggested using the auth overrides email admin setting to address this issue, while pfaffman advised configuring the authentication server to tell Discourse that the email address has been validated.
As a result of this discussion, blake updated the API docs to remove the email property from the PUT /u/{username}.json endpoint, which should save time spent on debugging in the future.
Thank you for your assistance. Maybe helpful to remove the email property from the PUT /u/{username.json} in the documentation. Could save time spent on debugging ;-).
The thing with the confirmation mail: I read about it on another topic. I don’t get the point. Just in case, Discourse is an application of many others in the project and the authentication of users is handled by a custom-made auth server (like my case). The auth server handles email confirmation. The applications should just do, what the auth server says. This is in my opinion the normal way. Otherwise it comes with multiple confirmation mails, different datasets…
Then you need to configure it to tell discourse that the email address has been validated and not update email on the API, but on your authentication server.