about summary refs log tree commit diff
path: root/config/initializers/doorkeeper.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-03-11 16:47:36 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-03-11 16:47:36 +0100
commit447cfef62d74a670ddd600c0240f41746ac2fe0a (patch)
tree5c3ed8838f90435b4c4c52a366059cbbd2a24a67 /config/initializers/doorkeeper.rb
parentb919f39b3186c5f022d3965cf6023ff9041e91ca (diff)
Improving feed queries, switching API to doorkeeper authentication
Diffstat (limited to 'config/initializers/doorkeeper.rb')
-rw-r--r--config/initializers/doorkeeper.rb9
1 files changed, 8 insertions, 1 deletions
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.