Class: Doorkeeper::OpenidConnect::DynamicClientRegistrationController

Inherits:
ApplicationMetalController
  • Object
show all
Defined in:
app/controllers/doorkeeper/openid_connect/dynamic_client_registration_controller.rb

Instance Method Summary collapse

Instance Method Details

#registerObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/doorkeeper/openid_connect/dynamic_client_registration_controller.rb', line 8

def register
  registration = OAuth::DynamicRegistrationRequest.new(::Doorkeeper.configuration, params)

  unless registration.valid?
    render json: registration.error_response, status: :bad_request
    return
  end

  client = Doorkeeper::Application.create!(application_params(registration))
  render json: registration_response(client, registration), status: :created
rescue ActiveRecord::RecordInvalid => e
  render json: { error: "invalid_client_params", error_description: e.record.errors.full_messages.join(", ") },
    status: :bad_request
end