WordPress.org

Support

Support » Multisite » Single sign-on for multiple single WordPress installs

Single sign-on for multiple single WordPress installs

Viewing 5 replies - 1 through 5 (of 5 total)
  • This is a clear case for Multisite and a plugin for separate domains. A Multisite is a network of sites sharing the same network admin(s) and users. Using Multisite means you have a standard setup, and may easily get help if something stops working.

    Having two or more single installs using a common login is possible, but would not recommend it for non-experts. I have been experimenting with it once, just to learn, as I’m no expert on such a setup.

    In addition to define common user and usermeta tables, you need to tell the browsers that if you are logged in in to one site, then they are also logged in to the other. To do this the cookies need to based on the same domain (and path) and passwords have the same hash (encryption), both in the database and as cookies. The following additional setup may not work for different domains, but it should work in a subdomain (at least I got it working, finally):

    $root_host = 'your-first-site-host';
    define( 'COOKIE_DOMAIN', '.'.$root_host );
    define( 'COOKIEHASH', md5('http://'.$root_host) );

    Then, you have to copy some (or all) of the secret keys, so that are the same on both sites. At lest the keys that have to do with login.

    Before testing, be sure to delete all browser cookies belonging to the domain, and restart your browser.

    I will point out that even with single sign on, you aren’t magically logged in to all domains at once, due to cross cookie contamination (tl;dr – for your own protection, you can’t have cookies cross domains). That said, the same username/password combo works 🙂

    Thanks for the reply,
    Not begin logged in across all sites and having the user login again when changing the site is not an issue. I only need the users to be the same and synced across the sites. So messing with cookies and all that wont be needed..

    So you do recommend building the two sites using the WordPress Network feature, even if they aren’t sub-blogs?

    Yes 🙂

    Subblog is just a designation for us humans, it doesn’t actually mean the sites are related. Each site is separate.

    Thanks broo, you save my day. This is really helpful !

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Single sign-on for multiple single WordPress installs’ is closed to new replies.
Skip to toolbar