# SSO Not Working with Organizations

**URL:** <https://community.auth0.com/t/sso-not-working-with-organizations/101055>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [February 22, 2023, 4:42pm UTC](https://community.auth0.com/t/sso-not-working-with-organizations/101055 "2023-02-22T16:42:33Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![tim.becker](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tim.becker/32/37493_2.png) [@tim.becker](https://community.auth0.com/u/tim.becker)\
**Post date:** [March 20, 2023, 3:50pm UTC](https://community.auth0.com/t/sso-not-working-with-organizations/101055/4 "2023-03-20T15:50:41Z")

</div>

We are now setting the org ID as a cookie whenever someone logs in, then clearing it when they log out. This fixes SSO for us by making the provider organization-aware.

It also serves as a sort of “remember me” for the organization prompt, which is a nice side effect.

_Note: We haven’t fully rolled this out yet, but we have tested it enough to be confident it’ll work._

```js
<Auth0Provider
      ...
      onRedirectCallback={(appState?: AppState, user?: User) => {
        if (user && user.org_id) {
          // using js-cookie
          Cookies.set('auth0OrgId', user.org_id, { domain: cookieDomain })
        }
        navigate((appState && appState.returnTo) ?? window.location.pathname)
      }}
      authorizationParams={{
        clientId: auth0ClientId,
        audience: auth0Audience,
        domain: auth0Url,
        organization: Cookies.get('auth0OrgId') ?? undefined,
        ...
      }}
      ...
>

```

If you are using the same client ID, this solution might be easier for you: [How to login once across multiple subdomains on a custom domain?](https://community.auth0.com/t/how-to-login-once-across-multiple-subdomains-on-a-custom-domain/78614)

I would still like an officially supported Auth0 feature for this, but since it’s going to work for our case, I am marking this as the solution.

---

_[View the full topic](https://community.auth0.com/t/sso-not-working-with-organizations/101055)._
