class Doorkeeper::OAuth::ErrorResponse

def self.from_request(request, attributes = {})

def self.from_request(request, attributes = {})
  state = request.state if request.respond_to?(:state)
  new(attributes.merge(name: request.error, state: state))
end

def authenticate_info

def authenticate_info
  %(Bearer realm="#{realm}", error="#{name}", error_description="#{description}")
end

def body

def body
  {
    error: name,
    error_description: description,
    state: state
  }.reject { |_, v| v.blank? }
end

def configuration

def configuration
  Doorkeeper.configuration
end

def headers

def headers
  { 'Cache-Control' => 'no-store',
    'Pragma' => 'no-cache',
    'Content-Type' => 'application/json; charset=utf-8',
    'WWW-Authenticate' => authenticate_info }
end

def initialize(attributes = {})

def initialize(attributes = {})
  @error = OAuth::Error.new(*attributes.values_at(:name, :state))
  @redirect_uri = attributes[:redirect_uri]
  @response_on_fragment = attributes[:response_on_fragment]
end

def redirect_uri

def redirect_uri
  if @response_on_fragment
    uri_with_fragment @redirect_uri, body
  else
    uri_with_query @redirect_uri, body
  end
end

def redirectable?

def redirectable?
  name != :invalid_redirect_uri && name != :invalid_client &&
    !URIChecker.native_uri?(@redirect_uri)
end

def status

def status
  :unauthorized
end