Skip to content

Instantly share code, notes, and snippets.

@bbansal
Created February 10, 2016 22:49
Show Gist options
  • Save bbansal/a4a1cb0b9d9fca3c9161 to your computer and use it in GitHub Desktop.
Save bbansal/a4a1cb0b9d9fca3c9161 to your computer and use it in GitHub Desktop.
def self.oauth_client
OAuth2::Client.new(
AppConfig.slack_api_client.client_id,
AppConfig.slack_api_client.client_secret,
site: 'https://slack.com',
authorize_url: '/oauth/authorize',
token_url: '/api/oauth.access',
)
end
oauth_token = oauth_client.auth_code.get_token(
code,
redirect_uri: redirect_uri,
headers: {'Authorization' => AUTHORIZATION_HEADER}
)
access_token = oauth_token.token
params = oauth_token.params
# In my code I was just getting params which dont have access-token as the library deletes it while setting the params.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment