8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# 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.configuration.application_model.create!(application_params(registration))
render json: registration_response(client, registration), status: :created
rescue ActiveRecord::RecordInvalid => e
render json: {
error: registration_error_code(e.record),
error_description: e.record.errors.full_messages.join(", "),
}, status: :bad_request
end
|