class Doorkeeper::OAuth::InvalidTokenResponse

Attributes

reason[R]

Public Class Methods

from_access_token(access_token, attributes = {}) click to toggle source
# File lib/doorkeeper/oauth/invalid_token_response.rb, line 6
def self.from_access_token(access_token, attributes = {})
  reason = if access_token.try(:revoked?)
             :revoked
           elsif access_token.try(:expired?)
             :expired
           else
             :unknown
           end

  new(attributes.merge(reason: reason))
end
new(attributes = {}) click to toggle source
Calls superclass method Doorkeeper::OAuth::ErrorResponse.new
# File lib/doorkeeper/oauth/invalid_token_response.rb, line 18
def initialize(attributes = {})
  super(attributes.merge(name: :invalid_token, state: :unauthorized))
  @reason = attributes[:reason] || :unknown
end

Public Instance Methods

description() click to toggle source
# File lib/doorkeeper/oauth/invalid_token_response.rb, line 23
def description
  scope = { scope: %[doorkeeper errors messages invalid_token] }
  @description ||= I18n.translate @reason, scope
end