Pass authentication between php and Ruby On Rails application

后端 未结 2 395
说谎
说谎 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:38

    The easiest way is to make use of cookies. In the PHP application, this cookie gets set, and the RoR application can read it's value.

    But with cookies you'll have to watch out for security, because the contents of the cookie can be set manually, and cookies can also be copied, which allows for stealing another persons cookie.

    Another option could be a session which is stored in a database both applications can make use of. The advantage of this option is that the contents of the session is stored on the server, and it can't be altered. The only thing you would have to handle is to identify the user belonging to the cookie.

提交回复
热议问题