Integrating with Drupal installed in subdomain

Discussion in 'Integration' started by powerkeys, Aug 31, 2009.

  1. powerkeys

    powerkeys Member

    Joined:
    Aug 29, 2006
    Messages:
    192
    I've been struggling with this all day, with no success.

    I originally set up my site with members content (managed by Drupal) in a folder (www.powerkeyspub.com/members) on my site.

    I'd like to move Drupal to a subdomain (members.powerkeyspub.com).

    No matter what I do, I cannot get aMember to log in to the subdomain instance.

    I suspect it comes down to the name of Drupal's session cookie, which is an MD5 hash of the cookie domain. aMember's Drupal integration module creates the cookie using the base URL, which is different, although it works fine for a normal installation.

    Can anyone offer any suggestions?
  2. powerkeys

    powerkeys Member

    Joined:
    Aug 29, 2006
    Messages:
    192
    It seems I was overthinking this. Turned out to be much simpler than I expected.

    For others facing a similar situation, the ONLY thing that needs to be set is the "base URL" in the Drupal integration settings within aMember. Make sure the base URL is set for the correct URL, and that's it. aMember doesn't use this for anything other than creating a session cookie to log a member into Drupal.

    To understand this, realize that Drupal names it's session cookie according to the URL from which it is accessed. So if Drupal is running from www.domain.com/members, then this is the URL you need to set in aMember.

    If Drupal runs from a subdomain, then set the base URL to sub1.domain.com.
    And if Drupal is running in a folder on a subdomain, your base URL may look like sub1.domain.com/members.

    From here, whenever you log in to aMember a session cookie will be created for Drupal to find at the intended URL, even if Drupal is running on a different subdomain than aMember.

    The only problem with this approach is that Drupal must be accessed from the same URL as indicated in aMember's base URL setting. If Drupal must be accessed from multiple subdomains, then special settings must be made within Drupal's setting.php files.
  3. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    Thanks for the followup Alan. Good stuff!
  4. davidgjohnson

    davidgjohnson New Member

    Joined:
    Feb 28, 2008
    Messages:
    17
    Alan, Congrats on getting this working. I realize this is quite an old post at this point, but I read it earlier today before implementing Drupal on a subdomain.

    My setup looks like this:

    Amember is installed on my primary domain in a folder (to accommodate SSL cert settings):

    http://www.epiphanymarketing.com/haiti/

    Meanwhile, Drupal is running on this subdomain:

    http://haiti.epiphanymarketing.com

    I have the Drupal logout working correctly (that was a slight departure from the documentation, but not too big a deal). Logging out from Drupal successfully logs the user out from Amember.

    Logging in via Amember, however, still doesn't log the user in to the Drupal installation on the subdomain. The accounts appear to be syncing up correctly, so the user can login via Drupal's login form, but the Single Sign-On isn't happening.

    My Drupal base URL is set to:

    haiti.epiphanymarketing.com

    I can't think of anything else to check. Any ideas?
  5. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Plugin should handle situation with subdomains. make sure that you use latest one, if issue still exists contact us in helpdesk We will fix this.
  6. davidgjohnson

    davidgjohnson New Member

    Joined:
    Feb 28, 2008
    Messages:
    17
    Thanks, Alexander. I didn't want to bug you until I was sure I had tried the solutions in the forums. I'm still stuck, so I'm creating a ticket. Thanks -- as always -- for the great support!

Share This Page