Sharing Session Between Two Applications

Hi

We have a rails application deployed and working fine. Along with this,
we are planning to add “Opinion” forum. The url of the forum will be
like http://forum.mymainsite.com Is it possible to share the session
(that is, if the user is already logged in on the main site, he need not
log in again on the forum section).

Is it possible to add the ‘opinion’ as a child of the rails website, to
keep the session.

thanks

=R

On 7/2/06, Rajesh GS [email protected] wrote:

keep the session.
I’m not sure how rails sets cookies. If it sets them for the whole
domain, and your forum runs on the same domain and sets cookies domain
wide also, then you should be able to share the cookie. As for the
session data it would probably work to share that, but of course your
forum would have to read/write to it in the correct format.

It would probably be easier to do it another way though. For example
have a secret that your rails app and the forum both know, and when
linking to the forum put the hashed secret in the query string and
have that signify that the user is logged in. Or create an action in
your rails app that verifies if a user is logged in, and have your
forum do an http post to the verification url. Both of those are
probably easier then trying to share the session data.

Chris

On Jul 2, 2006, at 10:48 PM, snacktime wrote:

the user is already logged in on the main site, he need not log in
session data it would probably work to share that, but of course your
Chris
Rajesh-

Set this in your config/environments/production.rb

ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update
( :session_domain => ‘.mymainsite.com’)

-Ezra

Ezra Z. wrote:

On Jul 2, 2006, at 10:48 PM, snacktime wrote:

the user is already logged in on the main site, he need not log in
session data it would probably work to share that, but of course your
Chris
Rajesh-

Set this in your config/environments/production.rb

ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update
( :session_domain => ‘.mymainsite.com’)

-Ezra

I’d like to do what Rajesh was trying to do. The MySQL session store
uses the session_id column as the key for the session data. Does Rails
use the same session_id on both the main site and the forum site to
access the MySQL session store?

Thanks.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs