Fix guardian db hook when refresh the access token

This commit is contained in:
Chocobozzz
2019-08-12 17:41:41 +02:00
parent 6d221212ef
commit ac1dab0fc0
5 changed files with 41 additions and 10 deletions

View File

@@ -61,6 +61,14 @@ defmodule MobilizonWeb.Guardian do
end
end
def on_refresh({old_token, old_claims}, {new_token, new_claims}, _options) do
with {:ok, _, _} <- Guardian.DB.on_refresh({old_token, old_claims}, {new_token, new_claims}) do
{:ok, {old_token, old_claims}, {new_token, new_claims}}
end
end
def on_exchange(old_stuff, new_stuff, options), do: on_refresh(old_stuff, new_stuff, options)
# def build_claims(claims, _resource, opts) do
# claims = claims
# |> encode_permissions_into_claims!(Keyword.get(opts, :permissions))