Sha256: 721d2159578f239dda8dceab39d77dacd11be667c97b1b73de0e968ac53203e1

Contents?: true

Size: 744 Bytes

Versions: 4

Compression:

Stored size: 744 Bytes

Contents

module Apress
  module Api
    module V1
      class TokensController < ApiController::Base
        if (Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR == 2) || Rails::VERSION::MAJOR > 4
          skip_before_action :authenticate, only: :create
        else
          skip_before_filter :authenticate, only: :create
        end

        def create
          @client = Apress::Api::Client.find_by_access_id!(params.require(:client_id))

          return bad_request if @client.refresh_token != params.require(:refresh_token)
          return forbidden if @client.refresh_token_expired?

          @client.regenerate_tokens!
        end

        ActiveSupport.run_load_hooks(:"apress/api/tokens_controller", self)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
apress-api-1.24.0 app/controllers/apress/api/v1/tokens_controller.rb
apress-api-1.23.0 app/controllers/apress/api/v1/tokens_controller.rb
apress-api-1.22.1 app/controllers/apress/api/v1/tokens_controller.rb
apress-api-1.22.0 app/controllers/apress/api/v1/tokens_controller.rb