How can I refresh expired Guardian access token in Elixir

526 Views Asked by At

Is there the way to refresh Guardian access token, if the one is expired?

1

There are 1 best solutions below

0
oldhomemovie On

Expired tokens cannot be used by definition. You should refresh a token before it expires. Per package readme, you would do it like this:

# Refresh a token before it expires
{:ok, _old_stuff, {new_token, new_claims}} = MyApp.Guardian.refresh(token)