Sha256: 798c0e0fa0cb36d372226937dbb93d4b304a9c98e943111ba888b2a47accc856

Contents?: true

Size: 685 Bytes

Versions: 4

Compression:

Stored size: 685 Bytes

Contents

# frozen_string_literal: true

require_relative 'auth_strategy'

module Redd
  module AuthStrategies
    # A password-based authentication scheme. Requests all scopes.
    class Script < AuthStrategy
      def initialize(client_id:, secret:, username:, password:, **kwargs)
        super(client_id: client_id, secret: secret, **kwargs)
        @username = username
        @password = password
      end

      # Perform authentication and return the resulting access object
      # @return [Access] the access token object
      def authenticate
        request_access('password', username: @username, password: @password)
      end
      alias refresh authenticate
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redd-0.8.1 lib/redd/auth_strategies/script.rb
redd-0.8.0 lib/redd/auth_strategies/script.rb
redd-0.8.0.pre.2 lib/redd/auth_strategies/script.rb
redd-0.8.0.pre.1 lib/redd/auth_strategies/script.rb