Class: Iron::Oauth::RegistrationsController

Inherits:
ActionController::API
  • Object
show all
Includes:
BoundedRequestBody
Defined in:
app/controllers/iron/oauth/registrations_controller.rb

Instance Method Summary collapse

Methods included from BoundedRequestBody

#process_action

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/iron/oauth/registrations_controller.rb', line 9

def create
  client = Client.new(
    name: client_name,
    redirect_uris: redirect_uris.join("\n"),
    scopes: Scope.default
  )

  if client.save
    render json: client_information(client), status: :created
  else
    render json: registration_error(client), status: :bad_request
  end
end