Sha256: e782ef026d8bd397530f292ed7886167b30621ed77786a8ca7989dc6bd5e014e

Contents?: true

Size: 801 Bytes

Versions: 17

Compression:

Stored size: 801 Bytes

Contents

# frozen_string_literal: true

module Doorkeeper
  module OAuth
    class TokenResponse
      attr_accessor :token

      def initialize(token)
        @token = token
      end

      def body
        {
          "access_token" => token.plaintext_token,
          "token_type" => token.token_type,
          "expires_in" => token.expires_in_seconds,
          "refresh_token" => token.plaintext_refresh_token,
          "scope" => token.scopes_string,
          "created_at" => token.created_at.to_i,
        }.reject { |_, value| value.blank? }
      end

      def status
        :ok
      end

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

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
doorkeeper-5.1.2 lib/doorkeeper/oauth/token_response.rb
doorkeeper-5.2.6 lib/doorkeeper/oauth/token_response.rb
doorkeeper-5.3.3 lib/doorkeeper/oauth/token_response.rb
doorkeeper-5.1.1 lib/doorkeeper/oauth/token_response.rb
doorkeeper-5.2.5 lib/doorkeeper/oauth/token_response.rb
doorkeeper-5.3.2 lib/doorkeeper/oauth/token_response.rb
doorkeeper-5.2.4 lib/doorkeeper/oauth/token_response.rb
doorkeeper-5.3.1 lib/doorkeeper/oauth/token_response.rb
doorkeeper-5.3.0 lib/doorkeeper/oauth/token_response.rb
doorkeeper-5.2.3 lib/doorkeeper/oauth/token_response.rb
doorkeeper-5.2.2 lib/doorkeeper/oauth/token_response.rb
doorkeeper-5.2.1 lib/doorkeeper/oauth/token_response.rb
doorkeeper-5.2.0 lib/doorkeeper/oauth/token_response.rb
doorkeeper-5.2.0.rc3 lib/doorkeeper/oauth/token_response.rb
doorkeeper-5.2.0.rc2 lib/doorkeeper/oauth/token_response.rb
doorkeeper-5.2.0.rc1 lib/doorkeeper/oauth/token_response.rb
doorkeeper-5.1.0 lib/doorkeeper/oauth/token_response.rb