Skip to content

Commit

Permalink
feat: update route querying doorkeeper app (LINCnil#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
syl-p authored Apr 25, 2023
1 parent 5fe3cc7 commit b0a644b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class ApplicationController < ActionController::API
end

def info
render json: { valid: true, auth: ENV['ENABLE_AUTHENTICATION'].present? }
client_app = Doorkeeper::Application.find_by(uid: params["client_id"], secret: params["client_secret"])
render json: { valid: client_app.present?, auth: ENV['ENABLE_AUTHENTICATION'].present? }
end

protected
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Rails.application.routes.draw do
use_doorkeeper if ENV['ENABLE_AUTHENTICATION'].present?
get '/info', to: 'application#info'
post '/info', to: 'application#info'

resources :users do
collection do
Expand Down

0 comments on commit b0a644b

Please sign in to comment.