OAuthProvider示例使用Doorkeeper实现Rails 4的OAuth 2身份验证
描述
该示例 Rails 4 应用程序 演示了如何使用带有设计的 Doorkeeper gem 来保护具有 2条腿的 OAuth 2 身份验证 API 端点。请注意,如果由于某种原因无法在生产应用程序中使用 SSL,则必须将 OAuth 2 与 SSL 一起使用,更好地使用 OAuth 1.0a。
安装步骤
-
克隆项目:git clone
-
进入目录:cd oauth_provider_example
-
安装依赖:bundle
-
迁移数据库:rake db:migrate
-
填充数据库:rake db:seed
-
启动服务器:rails s
种子任务
克隆项目:git clone
进入目录:cd oauth_provider_example
安装依赖:bundle
迁移数据库:rake db:migrate
填充数据库:rake db:seed
启动服务器:rails s
该 种子任务 将创建一个用户,其电子邮件地址为: ',密码为:'password123' 和三个联系人条目。现在转到 localhost:3000/oauth/applications 并创建一个新应用程序(例如“我的移动客户端”),您必须输入重定向 URI,但该 URI 未在此身份验证流程中使用,因此您只需使用该 URI。
下载地址
用户评论