Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 450601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:53:07+00:00 2026-05-12T21:53:07+00:00

I’ve seen the question asked a few times on the Google groups but no

  • 0

I’ve seen the question asked a few times on the Google groups but no one seems to follow-up with an answer or solution.. Is it possible to use a central database for User creation and authentication from multiple Rails applications using Authlogic?

It isn’t an option for me to use OpenID right now, I’d love to but my client does not support it yet.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T21:53:07+00:00Added an answer on May 12, 2026 at 9:53 pm

    It seems that there still hasn’t been a solution posted to the original question.

    I had a similar problem. I had multiple rails applications and I needed to be able to track users between activity on all of them. So, I wanted to have a single application for managing users and tracking and all the other applications would connect to this user database to authenticate.

    I was already using Authlogic for some other projects, so I was hoping that it would be as simple as changing some configuration settings.

    Here’s My solution:

    I created the main user tracking application. There was nothing special about the application. It allowed users to register, log in, log out, etc. Once users were logged in they could then navigate to the other apps.

    In the environments.rb file of my user application and every application needing to authenticate with the base application, you need to set up the session key and domain to be the SAME.

    config.action_controller.session = {
      :session_key => '_my_app_session',
      :secret      => '_long_secret_session_key_here',
      :domain => ".basedomain.com" 
    }
    

    Each of my applications are under their own subdomain, such as app1.basedomain.com app2.basedomain.com
    I’m not sure if this would work otherwise without some more changes.

    In each application, Create the UserSession

    class UserSession < Authlogic::Session::Base   
    end
    

    and User models.

    class User < ActiveRecord::Base
       establish_connection "users_database"
       acts_as_authentic 
    end
    

    What is different in this User model is that it now has the establish connection method. the “users_database” is in the database.yml file and points to the database for the central user management application.

    I didn’t go as far as having log in and log out throughout my sub-applications, but if you did you would have to create the UserSessionsController as well.

    In each application that uses authentication, I included some helper methods in the ApplicationController, for example,

       def current_user_session
          return @current_user_session if defined?(@current_user_session)
          @current_user_session = UserSession.find
       end
    
       def current_user
          return @current_user if defined?(@current_user)
          @current_user = current_user_session && current_user_session.record
       end
    
       def require_user
         unless current_user
           store_location
           redirect_to 'http://main_user_login_page'
           return false
         end
       end
    

    Then I can use ‘require_user’ in my controllers where I want authentication just like I can in my main user application.

    Hope this helps.

    Chase M Gray

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This could be a duplicate question, but I have no idea what search terms
I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I don't have much knowledge about the IPv6 protocol, so sorry if the question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.