views:

27

answers:

1

I have two different websites written in Rails(W1) and PHP(W2) both on different hosts. I used Authlogic for W1's authetication now I want to allow user of W1 to login into W2 using same username and password (as of W2). How can I do this?

A: 

The essence of the answer is that you need to somehow pass an authentication token to the php website. The way how you can do this differs. For example you can write a web-service on top of rails website, which php website would use to check supplied user credentials.

The other way is to manage a connection from php website to rails website database, and write a copy of authlogic authentication logic in php. It is not going to be very time consuming.

In Rails db you should operate with these fields of users table: login (email), password, salt, persistence_token.

cryo28
Thanks cryo28 for reply. Option 2 seems to be easy, but as am new to this coding field can you tell me authlogic's authentication logic and also its session logi(for this what basically I am thinking is I can ask PHP code to check session saved by Rails code and retrieve user_id from session and login into PHP website without actually having to separately fill login form). I would really appreciate your help.
Bhushan Lodha