Sha256: a2b8a8f9d25f49ab12d8683ea5600d0d8a59a712f68042c97de8b72ecc5fb9c9

Contents?: true

Size: 851 Bytes

Versions: 2

Compression:

Stored size: 851 Bytes

Contents

# frozen_string_literal: true

module Doorkeeper
  module OAuth
    class TokenResponse
      attr_reader :token

      alias issued_token token

      def initialize(token)
        @token = token
      end

      def body
        @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, no-cache",
          "Content-Type" => "application/json; charset=utf-8",
          "Pragma" => "no-cache",
        }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
doorkeeper-5.8.1 lib/doorkeeper/oauth/token_response.rb
doorkeeper-5.8.0 lib/doorkeeper/oauth/token_response.rb