<p>Our company has multiple domains set up with one website hosted on each of the domains. At this time, each domain has its own authentication which is done via cookies. </p>

<p>When someone logged on to one domain needs to access anything from the other, the user needs to log in again using different credentials on the other website, located on the other domain. </p>

<p>I was thinking of moving towards single sign on (SSO), so that this hassle can be eliminated. I would appreciate any ideas on how this could be achieved, as I do not have any experience in this regard.</p>

<p>Thanks.</p>

<p><strong>Edit:</strong>
The websites are mix of internet (external) and intranet (internal-used within the company) sites.</p>

[{'answer_id': 44524, 'author': 'Mike', 'author_id': 4523, 'author_profile': 'https://Stackoverflow.com/users/4523', 'pm_score': 2, 'selected': False, 'text': '<p>If you use Active Directory you could have each app use AD for authentication, login could then be seamless. </p>\n\n<p>Otherwise, if the applications can talk to each other behind the scenes, you could use sessionids and have one app handling id generation serving all of your other applications.</p>\n'}, {'answer_id': 44596, 'author': 'jason saldo', 'author_id': 1293, 'author_profile': 'https://Stackoverflow.com/users/1293', 'pm_score': 4, 'selected': False, 'text': '<p>How different are the host names?</p>\n<p>These hosts can share cookies:</p>\n<ul>\n<li><code>mail.xyz.example</code></li>\n<li><code>www.xyz.example</code></li>\n<li><code>logon.xyz.example</code></li>\n</ul>\n<p>But these cannot:</p>\n<ul>\n<li><code>abc.example</code></li>\n<li><code>xyz.example</code></li>\n<li><code>www.tre.example</code></li>\n</ul>\n<p>In the former case you can bang out a cookie-based solution. Think GUID and a database session table.</p>\n'}, {'answer_id': 45010, 'author': 'grom', 'author_id': 486, 'author_profile': 'https://Stackoverflow.com/users/486', 'pm_score': 7, 'selected': False, 'text': "<p>The SSO solution that I've implemented here works as follows:</p>\n<ol>\n<li>There is a master domain, <code>login.mydomain.example</code> with the script <code>master_login.php</code> that manages the logins.</li>\n<li>Each client domain has the script <code>client_login.php</code></li>\n<li>All the domains have a shared user session database.</li>\n<li>When the client domain requires the user to be logged in, it redirects to the master domain (<code>login.mydomain.example/master_login.php</code>). If the user has not signed in to the master it requests authentication from the user (ie. display login page). After the user is authenticated it creates a session in a database. If the user is already authenticated it looks up their session id in the database.</li>\n<li>The master domain returns to the client domain (<code>client.mydomain.example/client_login.php</code>) passing the session id.</li>\n<li>The client domain creates a cookie storing the session id from the master. The client can find out the logged in user by querying the shared database using the session id.</li>\n</ol>\n<p>Notes:</p>\n<ul>\n<li>The session id is a unique global identifier generated with algorithm from RFC 4122</li>\n<li>The <code>master_login.php</code> will only redirect to domains in its whitelist</li>\n<li>The master and clients can be in different top level domains. Eg. <code>client1.abc.example</code>, <code>client2.xyz.example</code>, <code>login.mydomain.example</code></li>\n</ul>\n"}, {'answer_id': 64643, 'author': 'Markc', 'author_id': 8609, 'author_profile': 'https://Stackoverflow.com/users/8609', 'pm_score': 5, 'selected': False, 'text': "<p>Don't re-invent the wheel. There are a number of open source cross-domain SSO packages such as JOSSO, OpenSSO, CAS, Shibboleth and others. If you're using Microsoft Technology throughout (IIS, AD), you can use microsoft federation (ADFS) instead.</p>\n"}]
['https://Stackoverflow.com/questions/44509', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1311/']