3

I am attempting a Single Sign On solution using the Bakery module.

My problem is each attempt to login results in the following error:

Logging out the user with the bad cookie.

Those failing login attempts are to the master site which also means I can't login to the sub-sites.

All the necessary configurations are in place.

  1. The master site is http://www.example.com/
  2. The master site checkbox is enabled
  3. http://sub.example.com/ is input as the slave site
  4. Cookie age is set to 3600
  5. Private key is examplesite
  6. Cookie domain is .examplesite.com
  7. Username and email are my enabled profile fields

I don't get why it's not responding with successful logins. Please help if you can.

2
  • I hope the private key is the same for master and slave sites, and that you set the slave site as slave.
    – apaderno
    Aug 1, 2016 at 9:52
  • @kiamlaluno: Yes, the private keys are the same but the issue is not regarding the slave site at the moment. Users are not allowed to even log into the master site
    – sisko
    Aug 1, 2016 at 11:26

1 Answer 1

0
+50

As an alternative to Bakery, if your sites are all co-hosted and you're using MySQL, you can get your sites to share user tables as described by Lullabot.

The important parts are the Master site setup:

$db_url = 'mysql://user:pass@localhost/master_database';
$db_prefix = '';

The shared cookie domain (which you already have):

$cookie_domain = '.example.com';

And the slave site setup:

$db_url = 'mysql://user:pass@localhost/slave_database';
$db_prefix = array(
   'default'   => 'name_of_slave_database.',
   'users'     => 'name_of_master_database.',
   'sessions'  => 'name_of_master_database.',
   'role'      => 'name_of_master_database.',
   'authmap'   => 'name_of_master_database.',
);

I have succeeded with this method in the past, though I think I used the normal database array instead of $db_url.

5
  • Yeah, I've been looking at this, and may very well do it, still it seems like there should be an actual answer to this question.
    – UltraBob
    Nov 9, 2016 at 0:04
  • Well, it looks like you are likely to get the bounty by default.
    – UltraBob
    Nov 15, 2016 at 1:58
  • 1
    I did. I think I'll write up a drupal 7 update to that lullabot post detailing how I did it, because I think it is less than obvious, and the lullabot method made some compromises I don't like.
    – UltraBob
    Nov 15, 2016 at 3:57
  • I dunno, I think it is useful for people who find this to see the alternative. If no one else gives the right answer, yours is the best I think.
    – UltraBob
    Nov 15, 2016 at 4:00
  • Fair call I guess.
    – Darvanen
    Nov 15, 2016 at 4:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.