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 7986325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:49:38+00:00 2026-06-04T11:49:38+00:00

I have two cakephp2 applications running on same database, but having different Auth tables

  • 0

I have two cakephp2 applications running on same database, but having different Auth tables and different $this->Auth->userModel values accordingly.
Authentication works well and users from one app can’t log into other.

BUT.. as apps uses same CAKEPHP session cookie, this happens:
when user from app ‘one’ logs in, it can access any Auth protected action in app ‘two’!

I will probably use different user roles and cookie names.
But still, why Auth component is ignoring Auth->userModel settings when checking the session? Is there a way to configure it to work right in this situation?

Thanks in advance for any suggestions.

  • 1 1 Answer
  • 0 Views
  • 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-06-04T11:49:39+00:00Added an answer on June 4, 2026 at 11:49 am

    If not configured otherwise, AuthComponent will write the authenticated user record to the Auth.User session key in CakePHP 2. But it can be changed:

    AuthComponent::sessionKey

    The session key name where the record of the current user is stored. If unspecified, it will be "Auth.User".

    (In CakePHP 1.3 this was different: Auth.{$userModel name})

    So, if your apps share a Session, which they do, if cookie name and Security.salt match, the logged in record will be shared.

    There are two possibilities to solve this:

    Separate the logins

    Simply set a different AuthComponent::sessionKey for your two models. This will allow them to keep the logged in user separately

    Separate the sessions

    Configure different Cookie names and Salts for both apps, so their sessions cannot override each other. This is probably the cleaner solution, because it also covers the risk of other session keys being double-used.

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

Sidebar

Related Questions

Let's say that I have two tables in my database: users countries I have
I'm doing a blog in CakePHP, so I have two tables in my database
I am using cakephp2. I have two questions I want to store different cache
I have two classes generated by LINQ2SQL both from the same table so they
I have two stored procedures I wish to use in my stored procedure, but
I have two essentially separate applications for configuring two pieces of hardware sold by
I am facing a strange error in cakephp2.0. I have created two layouts -
I have two models that I would like to save in the same table.
I have two applications in CakePHP, App A an App B. I want that
In CakePHP, I have two tables, Countries & Networks. They have a HABTM relationship

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.