Sha256: 5f76c76717af792aec430a6c907e7456c44de4b71709c4636ca4d491076c5ae2
Contents?: true
Size: 807 Bytes
Versions: 9
Compression:
Stored size: 807 Bytes
Contents
module Doorkeeper module OAuth class InvalidTokenResponse < ErrorResponse attr_reader :reason 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 def initialize(attributes = {}) super(attributes.merge(name: :invalid_token, state: :unauthorized)) @reason = attributes[:reason] || :unknown end def description scope = { scope: %i[doorkeeper errors messages invalid_token] } @description ||= I18n.translate @reason, scope end end end end
Version data entries
9 entries across 9 versions & 1 rubygems