class Doorkeeper::ApplicationsController

def create

def create
  @application = Doorkeeper.config.application_model.new(application_params)
  if @application.save
    flash[:notice] = I18n.t(:notice, scope: %i[doorkeeper flash applications create])
    flash[:application_secret] = @application.plaintext_secret
    respond_to do |format|
      format.html { redirect_to oauth_application_url(@application) }
      format.json { render json: @application, as_owner: true }
    end
  else
    respond_to do |format|
      format.html { render :new }
      format.json do
        errors = @application.errors.full_messages
        render json: { errors: errors }, status: :unprocessable_entity
      end
    end
  end
end