Secondary Emails with SSO

AI-generated summary

Users are discussing the inability to sync secondary emails with SSO in Discourse. barreeeiroo and Olivier_Lambert highlight that when a user logs in with a secondary email via SSO, Discourse creates a new account instead of updating the existing one. JonathanShaw explains that the SSO sync does not parse secondary emails and that the API does not allow setting secondary emails if ‘email editable’ is disabled, which is required for SSO authentication. A potential workaround involves using the user API instead of SSO API and hiding the email editing UI via a theme component. sfoster and Thatoo ask if there’s any progress or plans to address this issue, with JonathanShaw questioning if a pull request would be welcome for a proper fix.

How can I send the Secondary Emails with the SSO callback?

I’m using this PHP library:
https://github.com/cviebrock/discourse-php

Or how to add Secondary Emails to an user manually?

I really need this as well.

On my website, I’ve got multiple emails linked to one account. The user can use any one of them to connect.

When the user logs in to my platform, I also log him on the forum.

When he uses a different email than his main one, even though I specify his discourse ID and Username, Discourse creates a brand new user for that email. :confused:

The original question here is still unaddressed. As far as I can tell
(1) the SSO sync calls do not parse secondary emails
(2) secondary emails cannot be specified on the user by API using the /u/{username}/preferences/email route, if the “email editable” setting is not enabled, which is required for the “auth overrides email” setting typically used with sso.

This is unfortunate, as secondary emails are very useful for identifying inbound email and I have them on my sso provider. There seems to be no way to provide them to Discourse.

I suppose a very hacky workaround is
(1) to not use “auth overrides email” and instead use the user api not the sso api to set the user email.
(2) hide the email editing ui using a theme component

@sam is this pr-welcome for a proper fix to allow alternate emails to be set by discourse connect?

Curious if anyone has solved this problem? We use SSO and our provider allows for secondary emails. But then if the user logs in with that secondary email, Discourse creates a new account for the user. How can we just update the existing user with the secondary email?

Is there any news on this subject.
Is it planned to allow the possibility to sync secondary email from SSO?