From 447cfef62d74a670ddd600c0240f41746ac2fe0a Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 11 Mar 2016 16:47:36 +0100 Subject: Improving feed queries, switching API to doorkeeper authentication --- config/initializers/doorkeeper.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'config/initializers') diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb index 7418ba24d..22a379b66 100644 --- a/config/initializers/doorkeeper.rb +++ b/config/initializers/doorkeeper.rb @@ -7,6 +7,12 @@ Doorkeeper.configure do current_user || redirect_to(new_user_session_url) end + resource_owner_from_credentials do |routes| + request.params[:user] = { email: request.params[:username], password: request.params[:password] } + request.env["devise.allow_params_authentication"] = true + request.env["warden"].authenticate!(scope: :user) + end + # If you want to restrict access to the web interface for adding oauth authorized applications, you need to declare the block below. # admin_authenticator do # # Put your admin authentication logic here. @@ -90,7 +96,8 @@ Doorkeeper.configure do # http://tools.ietf.org/html/rfc6819#section-4.4.2 # http://tools.ietf.org/html/rfc6819#section-4.4.3 # - # grant_flows %w(authorization_code client_credentials) + + grant_flows %w(authorization_code password client_credentials) # Under some circumstances you might want to have applications auto-approved, # so that the user skips the authorization step. -- cgit