Single-Sign-On between multiple Salesforce Communities with custom domains on same Salesforce org

For a customer I was looking into Single-Sign-On (SSO) between multiple Salesforce Communities using a custom domain for each. Consider a customer with two communities (Community 1 at and Community 2 at – these could be different customer communities, a customer community and a partner community etc. The issue we encountered was that when using custom domains (i.e. and the built in session ID cookie support will not suffice as the cookie will be bound to the exact domain. This means the cookie is not sent along when accessing the second community and hence no SSO.

Now the solution to all this is using SAML with is baked into the Salesforce platform and included in the license. There is a bit more stuff to configure with SAML but once set up you get SSO for non-Salesforce Community properties as well such as a property on Heroku as well.

All in all I think it’s worth the additional configuration.

Before I list what I configured let me say that it may feel a bit convoluted as the Salesforce org is both the Identity Provider (IdP) and the Service Provider (SP) in SAML-speak. Usually Salesforce is either the one or the other but but not both.

Please note: Below I assume a certain level of knowledge about Salesforce Communities around controlling access to communities using Profiles, activating Communities and mapping to custom domains. All is well documented in the documentation but understand you cannot simply do the below steps and be done…

What I ended up configuring was the following:

  1. A community (“SSO”) used for Single-Sign-On and self-service (password reset etc.) where I style and brand the SSO experience at The community has a CA signed SSL certificate and a custom domain setup via the Domains setup.
  2. A community (“Community 1”) for customers at The community has a CA signed SSL certificate and a custom domain setup via the Domains setup.
  3. A community (“Community 2”) for customers at The community has a CA signed SSL certificate and a custom domain setup via the Domains setup.
  4. A Customer Community profile with the SSO community as the default community. This profile I use to control access to the communities in Members.
  5. I next configured the Salesforce as an Identity Provider using a self-signed certificate. This will allow the org to act as an IdP in a SAML authentication flow.
  6. Next I created 2 Single-Sign-On configurations (under “Single-Sign-On Settings” in Setup). One for and one for with separate, unique, entity IDs and mapping each to the appropriate community as the only login configuration under Workspaces/Administration/Login & Registration. I used “Federation ID” for the SAML Identity Type. Ensure you use the SAML configuration from the SSO community.
  7. Next configure the SSO community to only use “Username & Password” under Workspaces/Administration/Login & Registration. This ensures the customers actually are able to login using their Salesforce credentials.
  8. Under “App Manager” in Setup create a Connected App for each community configuring SAML and using the appropriate entity ID remembering to also set these to use Federation ID.
  9. Allow the community user profile to use the Connected Apps (both of them) and ensure user records have a federation ID set.

The result is that I can access all 3 communities on my custom domains. Accessing simply allows me to logon with username and password and do self-service incl. password reset etc. Accessing either or will redirect me to for authentication if not authenticated already. If already authenticated to it will simply bounce me via that and authenticate the user to the community transparently.


13 thoughts on “Single-Sign-On between multiple Salesforce Communities with custom domains on same Salesforce org”

  1. Hi Mikkel, definitely useful to understand how multiple community access can be setup on a single org. Question I have is how would you restrict access for some community users to one of the many communities on that org?


    1. Well this approach really doesn’t change anything when it comes to access control. The user – once authenticated and a user record location – still have a profile etc and that may be used to control access to communities. Where is the user is authenticated doesn’t matter. Makes sense?


  2. Mikkel, interesting post.

    This might be a silly question but how you ended up with multiple communities with different domains in the same org. So far what Ive seen is multiple communities under the same domain (i do not have extensive experience with communities, but this post look interested and even decided to give it a try in a dev org).

    Can you shed some light here? thanks!!!


  3. Hi Mikkel, thank you for this great post.

    I have a use case where two Digital Experiences (Communities) will need to allow users to just use a single set of credentials.

    Will this approach mean that:
    A.- We will have a single user that will be able to log in to the two experiences (and the additional experience created as the helper) using a single set of credentials AND a single User record in Salesforce?
    B.- Will this mean that the user will use a single set of credentials but 3 different user records? Each one with their Profile/Role that responds to the Digital Experience?

    In terms of visibility (roles) and profiles, how would it work in those cases A or B?

    Thank you so much for the great information.


    1. So that would be answer A. The user can access both (or all 3 actually) using a single set of credentials (1 User record). As to visibility that is controlled by the users profile and sharing rules as normal inside the org. Nothing special there.


      1. This is incredible helpful. Thank you so much Mikkel, appreciate the quick response.


  4. Hi Mikkel,
    I have similar setup as your described. It works fine when I started from the SSO site. However, when I initiated from the other community sites, I keep getting /_nc_external/identity/saml/SamlError. Do you have any idea what I did wrong?


    1. Sounds like the Service Provider side of the authentication is not correctly configured. I would get a SAML plugin and track the login process – normally that reveals what’s going on.


      1. Thank you for your response Mikkel,
        It seems to work fine when I login as system administrator user. it redirect to the SP site correctly, but for the customer user, it returns error. I check the SAML, it seems to return success response, just could redirect back to the SP siste.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s