Module: Slack::Web::Api::Endpoints::OauthV2

Included in:
Slack::Web::Api::Endpoints
Defined in:
lib/slack/web/api/endpoints/oauth_v2.rb

Instance Method Summary collapse

Instance Method Details

#oauth_v2_access(options = {}) ⇒ Object

Exchanges a temporary OAuth verifier code for an access token.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :client_id (string)

    Issued when you created your application. If possible, avoid sending client_id and client_secret as parameters in your request and instead supply the Client ID and Client Secret using the HTTP Basic authentication scheme.

  • :client_secret (string)

    Issued when you created your application. If possible, avoid sending client_id and client_secret as parameters in your request and instead supply the Client ID and Client Secret using the HTTP Basic authentication scheme.

  • :code (string)

    The code param returned via the OAuth callback.

  • :grant_type (string)

    The grant_type param as described in the OAuth spec.

  • :redirect_uri (string)

    This must match the originally submitted URI (if one was sent).

  • :refresh_token (string)

    The refresh_token param as described in the OAuth spec.

See Also:



26
27
28
# File 'lib/slack/web/api/endpoints/oauth_v2.rb', line 26

def oauth_v2_access(options = {})
  post('oauth.v2.access', options)
end

#oauth_v2_exchange(options = {}) ⇒ Object

Exchanges a legacy access token for a new expiring access token and refresh token

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :client_id (string)

    Issued when you created your application.

  • :client_secret (string)

    Issued when you created your application.

Raises:

  • (ArgumentError)

See Also:



39
40
41
42
43
# File 'lib/slack/web/api/endpoints/oauth_v2.rb', line 39

def oauth_v2_exchange(options = {})
  raise ArgumentError, 'Required arguments :client_id missing' if options[:client_id].nil?
  raise ArgumentError, 'Required arguments :client_secret missing' if options[:client_secret].nil?
  post('oauth.v2.exchange', options)
end