From e644f5e878ce5cc645db9cacf014e872fc8bd9a7 Mon Sep 17 00:00:00 2001 From: Daniel Schwartz Date: Thu, 1 Sep 2016 15:27:44 -0400 Subject: [PATCH] Fix user_info method for Add to Slack - When going through the standard Add to Slack authentication procedure, the user_identity["id"] is empty because you can't mix the identity.basic scopes with other team wide scopes. Luckily, Slack returns the current logged in users id in the access_token params object, so we should use that if user_identity["id"] is nil --- lib/omniauth/strategies/slack.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/omniauth/strategies/slack.rb b/lib/omniauth/strategies/slack.rb index 73befcb..3bba4c1 100644 --- a/lib/omniauth/strategies/slack.rb +++ b/lib/omniauth/strategies/slack.rb @@ -76,7 +76,7 @@ def team_identity def user_info url = URI.parse('/api/users.info') - url.query = Rack::Utils.build_query(user: user_identity['id']) + url.query = Rack::Utils.build_query(user: user_identity['id'] || access_token.params["user_id"]) url = url.to_s @user_info ||= access_token.get(url).parsed