diff --git a/README.md b/README.md index 35c684c..5680485 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ ```elixir def deps do - [{:ueberauth_slack, "~> 0.3"}] + [{:ueberauth_slack, "~> 0.4"}] end ``` diff --git a/lib/ueberauth/strategy/slack.ex b/lib/ueberauth/strategy/slack.ex index c6334bf..5299bd6 100644 --- a/lib/ueberauth/strategy/slack.ex +++ b/lib/ueberauth/strategy/slack.ex @@ -28,13 +28,16 @@ defmodule Ueberauth.Strategy.Slack do def handle_request!(conn) do scopes = conn.params["scope"] || option(conn, :default_scope) opts = [ scope: scopes ] - if conn.params["state"], do: opts = Keyword.put(opts, :state, conn.params["state"]) - callback_url = callback_url(conn) + opts = + if conn.params["state"], do: Keyword.put(opts, :state, conn.params["state"]), else: opts team = option(conn, :team) - if team, do: opts = Keyword.put(opts, :team, team) + opts = + if team, do: Keyword.put(opts, :team, team), else: opts - if String.ends_with?(callback_url, "?"), do: callback_url = String.slice(callback_url, 0..-2) + callback_url = callback_url(conn) + callback_url = + if String.ends_with?(callback_url, "?"), do: String.slice(callback_url, 0..-2), else: callback_url opts = Keyword.put(opts, :redirect_uri, callback_url) module = option(conn, :oauth2_module) @@ -205,9 +208,6 @@ defmodule Ueberauth.Strategy.Slack do defp fetch_team(%Plug.Conn{ assigns: %{ ueberauth_failure: _fails }} = conn, _), do: conn defp fetch_team(conn, token) do - auth = conn.private.slack_auth - token = conn.private.slack_token - scopes = (token.other_params["scope"] || "") |> String.split(",") diff --git a/mix.exs b/mix.exs index b3ac607..df654ac 100644 --- a/mix.exs +++ b/mix.exs @@ -1,21 +1,21 @@ defmodule UeberauthSlack.Mixfile do use Mix.Project - @version "0.3.0" + @version "0.4.0" def project do [app: :ueberauth_slack, version: @version, name: "Ueberauth Slack", - package: package, - elixir: "~> 1.1", + package: package(), + elixir: "~> 1.3", build_embedded: Mix.env == :prod, start_permanent: Mix.env == :prod, source_url: "https://github.com/hassox/ueberauth_slack", homepage_url: "https://github.com/hassox/ueberauth_slack", - description: description, - deps: deps, - docs: docs] + description: description(), + deps: deps(), + docs: docs()] end def application do @@ -25,11 +25,11 @@ defmodule UeberauthSlack.Mixfile do defp deps do [ {:oauth2, "0.6.0"}, - {:ueberauth, "~> 0.2"}, + {:ueberauth, "~> 0.4"}, # Docs dependencies - {:earmark, "~> 0.1", only: :dev}, - {:ex_doc, "~> 0.1", only: :dev}, + {:earmark, ">= 0.0.0", only: :dev}, + {:ex_doc, ">= 0.0.0", only: :dev}, ] end diff --git a/mix.lock b/mix.lock index 712d06a..f90f2a2 100644 --- a/mix.lock +++ b/mix.lock @@ -5,11 +5,12 @@ "httpoison": {:hex, :httpoison, "0.9.0", "68187a2daddfabbe7ca8f7d75ef227f89f0e1507f7eecb67e4536b3c516faddb", [:mix], [{:hackney, "~> 1.6.0", [hex: :hackney, optional: false]}]}, "idna": {:hex, :idna, "1.2.0", "ac62ee99da068f43c50dc69acf700e03a62a348360126260e87f2b54eced86b2", [:rebar3], []}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], []}, + "mime": {:hex, :mime, "1.0.1", "05c393850524767d13a53627df71beeebb016205eb43bfbd92d14d24ec7a1b51", [:mix], []}, "mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], []}, "mimetype_parser": {:hex, :mimetype_parser, "0.1.2", "221d2d3f727e89d80de5e1610fc2ce444514aa56f873da1b8fc9c033143e5d6a", [:mix], []}, "oauth2": {:hex, :oauth2, "0.6.0", "f3967aba3f358e64fb70046f659f04ea753d7a407ce032046dd048fc2e2e4be3", [:mix], [{:httpoison, "~> 0.7", [hex: :httpoison, optional: false]}, {:mimetype_parser, "~> 0.1", [hex: :mimetype_parser, optional: false]}, {:poison, "~> 1.3 or ~> 2.0", [hex: :poison, optional: false]}]}, - "plug": {:hex, :plug, "1.1.3", "2c1b01a51304ab1b88dc4313c0707e69998c8d6d4cdaeef391fa6003b6e31a5a", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, optional: true]}]}, + "plug": {:hex, :plug, "1.2.0", "496bef96634a49d7803ab2671482f0c5ce9ce0b7b9bc25bc0ae8e09859dd2004", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, optional: true]}, {:mime, "~> 1.0", [hex: :mime, optional: false]}]}, "poison": {:hex, :poison, "2.2.0", "4763b69a8a77bd77d26f477d196428b741261a761257ff1cf92753a0d4d24a63", [:mix], []}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.0", "edee20847c42e379bf91261db474ffbe373f8acb56e9079acb6038d4e0bf414f", [:rebar, :make], []}, "ssl_verify_hostname": {:hex, :ssl_verify_hostname, "1.0.5", "2e73e068cd6393526f9fa6d399353d7c9477d6886ba005f323b592d389fb47be", [:make], []}, - "ueberauth": {:hex, :ueberauth, "0.2.0", "9160c601b468c6692462a56be7ad8890d1a2d84519d7d9c4541da5b07d6495e1", [:mix], [{:plug, "~> 1.0", [hex: :plug, optional: false]}]}} + "ueberauth": {:hex, :ueberauth, "0.4.0", "bc72d5e5a7bdcbfcf28a756e34630816edabc926303bdce7e171f7ac7ffa4f91", [:mix], [{:plug, "~> 1.2", [hex: :plug, optional: false]}]}}