# Integration into custom auth system where emails are not unique?

**URL:** https://meta.discourse.org/t/integration-into-custom-auth-system-where-emails-are-not-unique/306489
**Category:** SSO
**Tags:** email
**Created:** [May 2, 2024, 3:50pm UTC](https://meta.discourse.org/t/integration-into-custom-auth-system-where-emails-are-not-unique/306489 "2024-05-02T15:50:43Z")
**Posts on this page:** 1
**Showing post:** 28

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [May 3, 2024, 11:06pm UTC](https://meta.discourse.org/t/integration-into-custom-auth-system-where-emails-are-not-unique/306489/28 "2024-05-03T23:06:07Z")

</div>

> [@jonbarrow](#):
>
> is it possible to manually update a user’s email at a later time?

Yes. You’ll need to enable the `auth overrides email` site setting for this. When enabled, a user’s Discourse email is synced with the email that included in the auth payload (the [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) payload for your case) each time the user logs in. If it’s not enabled, the user’s email will be set to the auth payload’s email when the account is initially created, but not updated on subsequent logins.

Assuming `auth overrides email` is enabled, you can also update it without requiring users to login by making an API request to the `sync_sso` route: [Sync DiscourseConnect user data with the sync\_sso route](https://meta.discourse.org/t/sync-discourseconnect-user-data-with-the-sync-sso-route/84398).

You could also update user’s email addresses in bulk from the site’s Rails console, but (I think) doing it that way will trigger a confirmation email to be sent from Discourse to the user. That won’t work with fake email addresses.

> [@jonbarrow](#):
>
> For example we’d update everyone’s Discourse email to something like `userid@example.com`, which connects to our SMTP server first and takes the `userid` to look up the user’s real email. This isn’t something we’d have ready for some time however, so we’d need to update users’ Discourse emails later if possible.

Maybe you could just set the emails to something meaningful to begin with. Once you’ve got a Discourse site setup, you should do some tests to see what email domains Discourse will accept for fake emails. Going from memory, I think `@invalid.com` is accepted. I’m not sure about other domains. On your end, you could map something like `<userId>@invalid.com` to the user’s actual email address.

---

_[View the full topic](https://meta.discourse.org/t/integration-into-custom-auth-system-where-emails-are-not-unique/306489)._
