# Invitations should be compatible with SSO

**URL:** <https://meta.discourse.org/t/invitations-should-be-compatible-with-sso/20813>\
**Category:** Feature\
**Tags:** invites\
**Created:** [Octobre 6, 2014, 1:12 UTC](https://meta.discourse.org/t/invitations-should-be-compatible-with-sso/20813 "2014-10-06T01:12:25Z")\
**Posts on this page:** 1\
**Showing post:** 25

<div class="post-metadata">

**Author:** ![Jared\_Needell](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jared_needell/32/116554_2.png) [@Jared\_Needell](https://meta.discourse.org/u/Jared_Needell)\
**Post date:** [Avril 28, 2016, 11:33 UTC](https://meta.discourse.org/t/invitations-should-be-compatible-with-sso/20813/25 "2016-04-28T11:33:36Z")

</div>

So I’ll share with you guys what I am doing.

I have OKTA setup as my SSO provider for authentication. OKTA connects to my company’s active directory environment and so I decided to use PowerShell to make scheduled tasks pre-staging users, placing them into groups, and also making them watchers of categories based on what group they are in.

I’ll share with you some of the PowerShell Snippets I have

Here are some Utility functions

> <https://pastebin.com/fzipEepL>

Here is what I use for pre-staging users, the utility script gets called to this.

> <https://pastebin.com/jF5nm9Xw>

If the user already exists, Discourse won’t create another one. I might utilize my pgSQL connection to check if the user exists before calling the user creation.

And here is my group sync with AD groups

> <https://pastebin.com/nJFGrttW>

Probably not the most efficient script but it works well.

Finally, I have a Discourse plugin that runs every 24 hours to make sure users remain watching a category even if they change it back to normal.

> <https://github.com/tekwreck/discourse-watch-category-mcneel/blob/master/plugin.rb>

---

_[View the full topic](https://meta.discourse.org/t/invitations-should-be-compatible-with-sso/20813)._
