我试图使用门卫(https://github.com/applicake/doorkeeper/)来设置一个简单的OAuth提供程序,但是在重命名我的路由时遇到严重问题。Rails 3.1中的门卫路由问题
我试图将我的基地门卫路线设置为'/ oauth2/v1',而不是预卷的'/ oauth'路线。
阅读维基(https://github.com/applicake/doorkeeper/wiki/Customizing-routes)似乎所有我需要做的是修改
Rails.application.routes.draw do
use_doorkeeper
end
到
Rails.application.routes.draw do
use_doorkeeper :scope => 'oauth2/v1'
end
或许命名空间use_doorkeeper到“的oauth2”,然后提供“一个范围V1' 。不幸的是没有用。我无法让门卫根本不使用任何其他范围。
维基本身似乎是相当落伍,像Rails不再使用那种在routes.rb中构建的,所以我实际上是试图改变看起来更像这样的代码:
DoorkeeperProvider::Application.routes.draw do
scope 'oauth2' do
use_doorkeeper :scope => 'v1'
end
...
end
但是,似乎没有什么能够改变范围。
这是耙路线的输出:
oauth_authorization GET /oauth2/oauth/authorize(.:format) {:action=>"new", :controller=>"doorkeeper/authorizations"}
oauth_authorization POST /oauth2/oauth/authorize(.:format) {:action=>"create", :controller=>"doorkeeper/authorizations"}
oauth_authorization DELETE /oauth2/oauth/authorize(.:format) {:action=>"destroy", :controller=>"doorkeeper/authorizations"}
oauth_token POST /oauth2/oauth/token(.:format) {:action=>"create", :controller=>"doorkeeper/tokens"}
oauth_applications GET /oauth2/oauth/applications(.:format) {:action=>"index", :controller=>"doorkeeper/applications"}
POST /oauth2/oauth/applications(.:format) {:action=>"create", :controller=>"doorkeeper/applications"}
new_oauth_application GET /oauth2/oauth/applications/new(.:format) {:action=>"new", :controller=>"doorkeeper/applications"}
edit_oauth_application GET /oauth2/oauth/applications/:id/edit(.:format) {:action=>"edit", :controller=>"doorkeeper/applications"}
oauth_application GET /oauth2/oauth/applications/:id(.:format) {:action=>"show", :controller=>"doorkeeper/applications"}
PUT /oauth2/oauth/applications/:id(.:format) {:action=>"update", :controller=>"doorkeeper/applications"}
DELETE /oauth2/oauth/applications/:id(.:format) {:action=>"destroy", :controller=>"doorkeeper/applications"}
oauth_authorized_applications GET /oauth2/oauth/authorized_applications(.:format) {:action=>"index", :controller=>"doorkeeper/authorized_applications"}
oauth_authorized_application DELETE /oauth2/oauth/authorized_applications/:id(.:format) {:action=>"destroy", :controller=>"doorkeeper/authorized_applications"}
oauth_token_info GET /oauth2/oauth/token/info(.:format) {:action=>"show", :controller=>"doorkeeper/token_info"}
它看起来好像:范围参数去use_doorkeeper只是被忽略。
在这一点上的任何提示将非常感激。
你能提供耙路线的输出吗?从理论上讲,最后一个选项应该可以工作 - 所有'use_doorkeeper'都会生成一个包装范围,它的配置值为:scope或'oauth' –
我已经为问题添加了“rake routes”输出,因为它也是这样大的发表评论。 – Nello