Pass authentication between php and Ruby On Rails application

后端 未结 2 374
说谎
说谎 2021-01-06 19:01

I have a simple Ruby on rails application that I want to integrate with an existing php website. I only want that users who\'s been authenticated by the php application woul

2条回答
  •  囚心锁ツ
    2021-01-06 19:44

    The most common way to keep a user logged in is to store something like current_user_id:777 in the user's session. Therefore, the easyest way is to share the session between the Rails app and the PHP app. Then, you must use the same convention to store the identity of a logged in user.

    A way to do this is to use memcached as the session support.

    Problems with this approach: you could set/read the same session variable in the same time from both apps (but it can be avoided).

    References:

    Storing your php sessions using memcached

    Usind memcache as rails session store

提交回复
热议问题