Module: Slack::Endpoint::Oauth

Included in:
Slack::Endpoint
Defined in:
lib/slack/endpoint/oauth.rb

Instance Method Summary collapse

Instance Method Details

#oauth_access(options = {}) ⇒ Object

Exchanges a temporary OAuth code for an API token.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :client_id (Object)

    Issued when you created your application.

  • :client_secret (Object)

    Issued when you created your application.

  • :code (Object)

    The code param returned via the OAuth callback.

  • :redirect_uri (Object)

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

See Also:



20
21
22
23
24
25
# File 'lib/slack/endpoint/oauth.rb', line 20

def oauth_access(options={})
  throw ArgumentError.new("Required arguments :client_id missing") if options[:client_id].nil?
  throw ArgumentError.new("Required arguments :client_secret missing") if options[:client_secret].nil?
  throw ArgumentError.new("Required arguments :code missing") if options[:code].nil?
  post("oauth.access", options)
end

#oauth_token(options = {}) ⇒ Object

Exchanges a temporary OAuth verifier code for a workspace token.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :client_id (Object)

    Issued when you created your application.

  • :client_secret (Object)

    Issued when you created your application.

  • :code (Object)

    The code param returned via the OAuth callback.

  • :redirect_uri (Object)

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

  • :single_channel (Object)

    Request the user to add your app only to a single channel.

See Also:



43
44
45
46
47
48
# File 'lib/slack/endpoint/oauth.rb', line 43

def oauth_token(options={})
  throw ArgumentError.new("Required arguments :client_id missing") if options[:client_id].nil?
  throw ArgumentError.new("Required arguments :client_secret missing") if options[:client_secret].nil?
  throw ArgumentError.new("Required arguments :code missing") if options[:code].nil?
  post("oauth.token", options)
end