# SSO users aren't automatically added to email domain-based groups

**URL:** <https://meta.discourse.org/t/sso-users-arent-automatically-added-to-email-domain-based-groups/66980>\
**Category:** Bug\
**Created:** [July 28, 2017, 2:33am UTC](https://meta.discourse.org/t/sso-users-arent-automatically-added-to-email-domain-based-groups/66980 "2017-07-28T02:33:29Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![mbb70](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@mbb70](https://meta.discourse.org/u/mbb70)\
**Post date:** [October 20, 2017, 5:14pm UTC](https://meta.discourse.org/t/sso-users-arent-automatically-added-to-email-domain-based-groups/66980/5 "2017-10-20T17:14:55Z")

</div>

Hi @sebastien,

When you are generating your SSO payload, you can set the `add_groups` field based on your user’s email, where `add_groups` is a comma delimited string of groups. I haven’t seen any documentation on this but the code is pretty clear:

> <https://github.com/discourse/discourse/blob/9813f9f0f8c9f4b446aa9f50e5c447161db0c7d5/app/models/discourse_single_sign_on.rb#L110-L119>

That was our workaround to this issue and it has been working so far.

---

_[View the full topic](https://meta.discourse.org/t/sso-users-arent-automatically-added-to-email-domain-based-groups/66980)._
