From 04ca44d0807b361da78f1ed600cd004dd7b4a068 Mon Sep 17 00:00:00 2001 From: Rasmus Larsson Date: Sat, 15 Jun 2019 16:59:26 +0200 Subject: [PATCH] Dependencies upgrade - Ueberauth - Elixir (to same as Ueberauth) - OAuth2 Fix: link name in README Added JSON serializer needed by OAuth2 client --- README.md | 2 +- lib/ueberauth/strategy/slack/oauth.ex | 18 +++++++----- mix.exs | 41 +++++++++++++++------------ mix.lock | 26 ++++++++++------- 4 files changed, 51 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 97c2ce0..d52b609 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ ```elixir def deps do - [{:ueberauth_slack, "~> 0.5"}] + [{:ueberauth_slack, "~> 0.6"}] end ``` diff --git a/lib/ueberauth/strategy/slack/oauth.ex b/lib/ueberauth/strategy/slack/oauth.ex index 37b3ed0..76558b9 100644 --- a/lib/ueberauth/strategy/slack/oauth.ex +++ b/lib/ueberauth/strategy/slack/oauth.ex @@ -11,18 +11,22 @@ defmodule Ueberauth.Strategy.Slack.OAuth do def client(opts \\ []) do slack_config = Application.get_env(:ueberauth, Ueberauth.Strategy.Slack.OAuth) + client_opts = @defaults |> Keyword.merge(slack_config) |> Keyword.merge(opts) - OAuth2.Client.new(client_opts) + client_opts + |> OAuth2.Client.new() + |> OAuth2.Client.put_serializer("application/json", Jason) end def get(token, url, params \\ %{}, headers \\ [], opts \\ []) do - url = [token: token] - |> client() - |> to_url(url, Map.put(params, "token", token.access_token)) + url = + [token: token] + |> client() + |> to_url(url, Map.put(params, "token", token.access_token)) OAuth2.Client.get(client(), url, headers, opts) end @@ -34,10 +38,10 @@ defmodule Ueberauth.Strategy.Slack.OAuth do end def get_token!(params \\ [], options \\ %{}) do - headers = Map.get(options, :headers, []) - options = Map.get(options, :options, []) + headers = Map.get(options, :headers, []) + options = Map.get(options, :options, []) client_options = Keyword.get(options, :client_options, []) - + client = OAuth2.Client.get_token!(client(client_options), params, headers, options) client.token diff --git a/mix.exs b/mix.exs index 28a5a59..7791fd2 100644 --- a/mix.exs +++ b/mix.exs @@ -1,21 +1,23 @@ defmodule UeberauthSlack.Mixfile do use Mix.Project - @version "0.5.0" + @version "0.6.0" def project do - [app: :ueberauth_slack, - version: @version, - name: "Ueberauth Slack", - 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()] + [ + app: :ueberauth_slack, + version: @version, + name: "Ueberauth Slack", + package: package(), + elixir: "~> 1.4", + 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() + ] end def application do @@ -24,13 +26,14 @@ defmodule UeberauthSlack.Mixfile do defp deps do [ - {:oauth2, "~> 0.8.0"}, - {:ueberauth, "~> 0.4"}, + {:oauth2, "~> 1.0"}, + {:ueberauth, "~> 0.6"}, + {:jason, "~> 1.0"}, # dev/test dependencies {:credo, "~> 0.5", only: [:dev, :test]}, {:earmark, ">= 0.0.0", only: :dev}, - {:ex_doc, ">= 0.0.0", only: :dev}, + {:ex_doc, ">= 0.0.0", only: :dev} ] end @@ -43,9 +46,11 @@ defmodule UeberauthSlack.Mixfile do end defp package do - [files: ["lib", "mix.exs", "README.md"], + [ + files: ["lib", "mix.exs", "README.md"], maintainers: ["Daniel Neighman"], licenses: ["MIT"], - links: %{"Slack": "https://github.com/hassox/ueberauth_slack"}] + links: %{GitHub: "https://github.com/hassox/ueberauth_slack"} + ] end end diff --git a/mix.lock b/mix.lock index 52c1e15..9ce9cc7 100644 --- a/mix.lock +++ b/mix.lock @@ -1,18 +1,24 @@ -%{"bunt": {:hex, :bunt, "0.1.6", "5d95a6882f73f3b9969fdfd1953798046664e6f77ec4e486e6fafc7caad97c6f", [:mix], []}, - "certifi": {:hex, :certifi, "0.7.0", "861a57f3808f7eb0c2d1802afeaae0fa5de813b0df0979153cbafcd853ababaf", [:rebar3], []}, +%{ + "bunt": {:hex, :bunt, "0.1.6", "5d95a6882f73f3b9969fdfd1953798046664e6f77ec4e486e6fafc7caad97c6f", [:mix], []}, + "certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"}, "credo": {:hex, :credo, "0.5.3", "0c405b36e7651245a8ed63c09e2d52c2e2b89b6d02b1570c4d611e0fcbecf4a2", [:mix], [{:bunt, "~> 0.1.6", [hex: :bunt, optional: false]}]}, "earmark": {:hex, :earmark, "0.1.19", "ffec54f520a11b711532c23d8a52b75a74c09697062d10613fa2dbdf8a9db36e", [:mix], []}, "ex_doc": {:hex, :ex_doc, "0.10.0", "f49c237250b829df986486b38f043e6f8e19d19b41101987f7214543f75947ec", [:mix], [{:earmark, "~> 0.1.17 or ~> 0.2", [hex: :earmark, optional: true]}]}, - "hackney": {:hex, :hackney, "1.6.5", "8c025ee397ac94a184b0743c73b33b96465e85f90a02e210e86df6cbafaa5065", [:rebar3], [{:certifi, "0.7.0", [hex: :certifi, optional: false]}, {:idna, "1.2.0", [hex: :idna, optional: false]}, {:metrics, "1.0.1", [hex: :metrics, optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, optional: false]}]}, + "hackney": {:hex, :hackney, "1.15.1", "9f8f471c844b8ce395f7b6d8398139e26ddca9ebc171a8b91342ee15a19963f4", [:rebar3], [{:certifi, "2.5.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.4", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"}, "httpoison": {:hex, :httpoison, "0.9.0", "68187a2daddfabbe7ca8f7d75ef227f89f0e1507f7eecb67e4536b3c516faddb", [:mix], [{:hackney, "~> 1.6.0", [hex: :hackney, optional: false]}]}, - "idna": {:hex, :idna, "1.2.0", "ac62ee99da068f43c50dc69acf700e03a62a348360126260e87f2b54eced86b2", [:rebar3], []}, + "idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"}, + "jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], []}, - "mime": {:hex, :mime, "1.0.1", "05c393850524767d13a53627df71beeebb016205eb43bfbd92d14d24ec7a1b51", [:mix], []}, - "mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], []}, + "mime": {:hex, :mime, "1.3.1", "30ce04ab3175b6ad0bdce0035cba77bba68b813d523d1aac73d9781b4d193cf8", [:mix], [], "hexpm"}, + "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm"}, "mimetype_parser": {:hex, :mimetype_parser, "0.1.2", "221d2d3f727e89d80de5e1610fc2ce444514aa56f873da1b8fc9c033143e5d6a", [:mix], []}, - "oauth2": {:hex, :oauth2, "0.8.3", "080ea0bf2f7060ddb66204ed756b8363d8c34f20fc5684183a16f19fc5d3ad97", [:mix], [{:hackney, "~> 1.6", [hex: :hackney, optional: false]}]}, - "plug": {:hex, :plug, "1.2.0", "496bef96634a49d7803ab2671482f0c5ce9ce0b7b9bc25bc0ae8e09859dd2004", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, optional: true]}, {:mime, "~> 1.0", [hex: :mime, optional: false]}]}, + "oauth2": {:hex, :oauth2, "1.0.1", "2a116de7863d4b5a8a265d77e62b17a6f54e0c01a5bbbf02210783cb861e49ac", [:mix], [{:hackney, "~> 1.13", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"}, + "parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm"}, + "plug": {:hex, :plug, "1.8.2", "0bcce1daa420f189a6491f3940cc77ea7fb1919761175c9c3b59800d897440fc", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm"}, + "plug_crypto": {:hex, :plug_crypto, "1.0.0", "18e49317d3fa343f24620ed22795ec29d4a5e602d52d1513ccea0b07d8ea7d4d", [:mix], [], "hexpm"}, "poison": {:hex, :poison, "2.2.0", "4763b69a8a77bd77d26f477d196428b741261a761257ff1cf92753a0d4d24a63", [:mix], []}, - "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], []}, + "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.4", "f0eafff810d2041e93f915ef59899c923f4568f4585904d010387ed74988e77b", [:make, :mix, :rebar3], [], "hexpm"}, "ssl_verify_hostname": {:hex, :ssl_verify_hostname, "1.0.5", "2e73e068cd6393526f9fa6d399353d7c9477d6886ba005f323b592d389fb47be", [:make], []}, - "ueberauth": {:hex, :ueberauth, "0.4.0", "bc72d5e5a7bdcbfcf28a756e34630816edabc926303bdce7e171f7ac7ffa4f91", [:mix], [{:plug, "~> 1.2", [hex: :plug, optional: false]}]}} + "ueberauth": {:hex, :ueberauth, "0.6.1", "9e90d3337dddf38b1ca2753aca9b1e53d8a52b890191cdc55240247c89230412", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"}, + "unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm"}, +}