Rails plugin for API Key + Secret Key signing [clo

2020-05-19 06:56发布

Is there a Rails plugin or a rubygem that gives you a starting point for adding an api to your Rails app? We want to use the API Key/Secret Key model, the API should also be versionable. Is there something out there that will give us some, if not all of this?

2条回答
聊天终结者
2楼-- · 2020-05-19 07:33

Check out this plugin for AuthLogic:

http://github.com/phurni/authlogic_api

I think that does what you are looking for.

查看更多
叛逆
3楼-- · 2020-05-19 07:44

The OAuth plugin could be useful for the keys. It may look like OAuth is only for user authentication, but if you autogenerate the access tokens and give them to developers, instead of having an interactive user process with request tokens and account authorization, then you basically have a quite secure API key system. And the plugin will just drop in nicely.

Other than that, some nice use of rails' routes (with conditions to call a different action on get, post, put, etc, and a prefix of /api/v1/) and format (format.xml, format.js, etc) provides a pretty nice way to build RESTful APIs, withought really needing a plugin.

查看更多
登录 后发表回答