Seems like I'm missing the revoke() method in oauth controller. But I wonder why? Isn't it suppose to be part of OAuth::Controllers?
My current oauth_controller.rb looks like this:
require 'oauth/controllers/provider_controller'
class OauthController < ApplicationController
include OAuth::Controllers::ProviderController
def login_required
authenticate_user!
end
protected
Override this to match your authorization page form
It currently expects a checkbox called authorize
def user_authorizes_token?
params[:authorize] == '1'
end
should authenticate and return a user if valid password.
This example should work with most Authlogic or Devise. Uncomment it
def authenticate_user(username,password)
user = User.find_by_email params[:username]
if user && user.valid_password?(params[:password])
user
else
nil
end
end
I'm getting this error when trying to access /oauth_clients after I've authorize a client app to access my account:
ActionController::RoutingError in Oauth_clients#index
Showing /home/alex/hundredthings/app/views/oauth_clients/index.html.erb where line #12 raised:
No route matches {:controller=>"oauth", :action=>"revoke"} Extracted source (around line #12):
9:
Application Trace | Framework Trace | Full Trace app/views/oauth_clients/index.html.erb:12:in
block (2 levels) in _app_views_oauth_clients_index_html_erb__4342959844419038579_39707540_1970803616456943060' app/views/oauth_clients/index.html.erb:8:in
block in _app_views_oauth_clients_index_html_erb__4342959844419038579_39707540_1970803616456943060' app/views/oauth_clients/index.html.erb:7:ineach' app/views/oauth_clients/index.html.erb:7:in
_app_views_oauth_clients_index_html_erb__4342959844419038579_39707540_1970803616456943060'Wonder how to fix this?
Using Rails 3.0.5 with oauth and oauth_plugin gems:
gem 'oauth', '>= 0.3.0' gem 'oauth-plugin', '>=0.4.0.pre1'
Seems like I'm missing the revoke() method in oauth controller. But I wonder why? Isn't it suppose to be part of OAuth::Controllers?
My current oauth_controller.rb looks like this:
require 'oauth/controllers/provider_controller' class OauthController < ApplicationController include OAuth::Controllers::ProviderController
def login_required authenticate_user! end
protected
Override this to match your authorization page form
It currently expects a checkbox called authorize
def user_authorizes_token?
params[:authorize] == '1'
end
should authenticate and return a user if valid password.
This example should work with most Authlogic or Devise. Uncomment it
def authenticate_user(username,password) user = User.find_by_email params[:username] if user && user.valid_password?(params[:password]) user else nil end end
end
Simply put post "/oauth/revoke" in routes.rb
There are several other changes to do. Look at: http://unhandledexpression.com/2011/06/02/rails-and-oauth-plugin-part-1-the-provider/ http://www.cocoalife.net/2011/02/post_866.html
Cool, thanks! Updating routes.rb worked! Thanks for useful links too.