Skip to content

Commit

Permalink
Merge pull request #2 from TruemarkDev/features/add_team_info_in_auth
Browse files Browse the repository at this point in the history
Updated the slack strategy to include the team info in auth response
  • Loading branch information
poudelprakash authored Jul 15, 2024
2 parents 407ca6d + 28b8b18 commit e516c3c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/omniauth/strategies/slack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class Slack < OmniAuth::Strategies::OAuth2
extra do
hash = {
"raw_info" => raw_info,
"token_type" => access_token.params["token_type"]
"token_type" => access_token.params["token_type"],
"team_info" => team_identity
}
hash["bot_info"] = bot_info if access_token.params["token_type"] == "bot"
hash
Expand Down Expand Up @@ -61,6 +62,10 @@ def raw_info
end
end

def team_identity
@team_identity ||= identity["team"].to_h
end

def callback_url
full_host + script_name + callback_path
end
Expand Down Expand Up @@ -114,7 +119,6 @@ def csrf_check_failed?
!secure_compare(request.params["state"], session.delete("omniauth.state")))
end


def secure_compare(string_a, string_b)
return false unless string_a.bytesize == string_b.bytesize

Expand Down

0 comments on commit e516c3c

Please sign in to comment.