From ec39358f5b6253e921cd2c8ccd5f85aeadb4a8d7 Mon Sep 17 00:00:00 2001 From: dania02525 Date: Mon, 6 Apr 2015 20:39:58 -0500 Subject: [PATCH] Fixed param error at decode/5 --- lib/plug_jwt.ex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/plug_jwt.ex b/lib/plug_jwt.ex index 03663a1..86d6f59 100644 --- a/lib/plug_jwt.ex +++ b/lib/plug_jwt.ex @@ -20,6 +20,7 @@ defmodule PlugJwt do secret = Keyword.fetch!(opts, :secret) json_module = Keyword.fetch!(opts, :json_module) claims = Keyword.get(opts, :claims, %{}) + algorithm = Application.get_env(:joken, :algorithm, :HS256) {secret, json_module, claims} end @@ -28,8 +29,8 @@ defmodule PlugJwt do parse_auth(conn, get_req_header(conn, "authorization"), config) end - defp parse_auth(conn, ["Bearer " <> token], {secret, json_module, claims}) do - case Joken.Token.decode(secret, json_module, token, claims) do + defp parse_auth(conn, ["Bearer " <> token], {secret, json_module, algorithm, claims}) do + case Joken.Token.decode(secret, json_module, token, algorithm, claims) do {:error, error} -> create_401_response(conn, error, json_module) {:ok, payload} ->