[英]Routing problems with doorkeeper in Rails 3.1
我正在嘗試使用Doorkeeper( https://github.com/applicake/doorkeeper/ )來建立一個簡單的OAuth提供程序,但是在重命名我的路線時遇到了嚴重的問題。
我正在嘗試將我的基本門衛路線設置為“ / oauth2 / v1”,而不是預先提供的“ / oauth”路線。
閱讀Wiki( 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'。 不幸的是,沒有任何效果。 我根本無法讓門衛使用任何其他范圍。
Wiki本身似乎已經過時了,因為Rails不再在route.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的:scope參數只是被忽略。
在這一點上的任何提示將不勝感激。
因此,您似乎遇到了最近已解決的問題。 在此處查看提交-https: //github.com/applicake/doorkeeper/commit/a12f9eacaa9714a0681b42f0685e491e296d6560
您正在運行什么版本? 理論上,該值應固定在0.7.3中。
我會嘗試從Github上的applicake / doorkeeper使用doorkeeper的master分支。 那應該解決這個問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.