Skip to content

Commit

Permalink
Merge pull request #2 from Dania02525/master
Browse files Browse the repository at this point in the history
Fixed param error at decode/5
  • Loading branch information
bryanjos committed Apr 7, 2015
2 parents ad7b406 + ec39358 commit 1433c31
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/plug_jwt.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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} ->
Expand Down

0 comments on commit 1433c31

Please sign in to comment.