Sha256: 359b111208a1df26975be935215029ce0db150629231dc6be74974899b051bb9

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

module BacklogKit
  class Client

    # Methods for OAuth 2.0 authorization
    #
    # @see http://developer.nulab-inc.com/docs/backlog/auth
    module Authorization

      # Create a new access token
      #
      # @param oauth_code [String] Authorization code that you get from the authorization endpoint
      # @return [BacklogKit::Response] The token information
      def create_token(oauth_code)
        params = {
          client_id: client_id,
          client_secret: client_secret,
          grant_type: 'authorization_code',
          code: oauth_code
        }
        params.merge!(redirect_uri: redirect_uri) if redirect_uri
        request(:post, 'oauth2/token', params, true)
      end

      # Refresh an access token
      #
      # @return [BacklogKit::Response] The token information
      def update_token
        params = {
          client_id: client_id,
          client_secret: client_secret,
          grant_type: 'refresh_token',
          refresh_token: refresh_token
        }
        request(:post, 'oauth2/token', params, true)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
backlog_kit-0.13.0 lib/backlog_kit/client/authorization.rb