module Slack::Endpoint::Oauth

Public Instance Methods

oauth_access(options={}) click to toggle source

This method allows you to exchange a temporary OAuth code for an API access token. This is used as part of the OAuth authentication flow.

@option options [Object] :client_id

Issued when you created your application.

@option options [Object] :client_secret

Issued when you created your application.

@option options [Object] :code

The code param returned via the OAuth callback.

@option options [Object] :redirect_uri

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

@see api.slack.com/methods/oauth.access @see github.com/aki017/slack-api-docs/blob/master/methods/oauth.access.md @see github.com/aki017/slack-api-docs/blob/master/methods/oauth.access.json

# File lib/slack/endpoint/oauth.rb, line 21
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?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("oauth.access", options)
end