简体   繁体   中英

Restful API in rails 3

How should I go about creating a restful API in rails 3 app? Also I would like to know if there is a good way to implement restful authentication

Restful API in rails 3? Rails is restful.. just use routes [ guide ]

As for authentication, i strongly recommend devise . It's also the only one I have managed to get working on rails 3.

如果您正在寻找一种方法来验证使用您的API的应用程序,请查看restful_api_authentication gem - https://rubygems.org/gems/restful_api_authentication

The easiest way to create RESTful authentication in Rails is the combination of a User Model and a Session controller. So you will have new(login), create(authenticate), destroy(logout) actions in the Session controller. Depending on the app its fairly easy to write your own authentication. This screencast shows how easy it is. Authentication in Rails 3.1

你可以使用插件葡萄

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM