Skip to content

Commit

Permalink
Allow restricting login to a specific team ID
Browse files Browse the repository at this point in the history
  • Loading branch information
bklang committed Nov 29, 2015
1 parent 6849a9c commit e113e2c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@
]
```

You can optionally restrict authentication by providing your team ID. [Find your Slack team ID here](https://api.slack.com/methods/auth.test/test). Note that this is NOT your team's Slack domain name!
```elixir
config :ueberauth, Ueberauth,
providers: [
slack: [
{Ueberauth.Strategy.Slack, [
team: "0ABCDEF"
]}
]
]
```
1. Update your provider configuration:
```elixir
Expand Down
3 changes: 3 additions & 0 deletions lib/ueberauth/strategy/slack.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ defmodule Ueberauth.Strategy.Slack do
if conn.params["state"], do: opts = Keyword.put(opts, :state, conn.params["state"])
callback_url = callback_url(conn)

team = option(conn, :team)
if team, do: opts = Keyword.put(opts, :team, team)

if String.ends_with?(callback_url, "?"), do: callback_url = String.slice(callback_url, 0..-2)

opts = Keyword.put(opts, :redirect_uri, callback_url)
Expand Down

0 comments on commit e113e2c

Please sign in to comment.