ueberauth / guardian

Elixir Authentication
MIT License
3.44k stars 381 forks source link

Guardian.Plug.sign_out doesn't call revoke #447

Closed kelostrada closed 6 years ago

kelostrada commented 6 years ago

Is it intentional that sign_out doesn't call revoke on tokens?

denvaar commented 6 years ago

From what I understand, revoke only works if you are storing the tokens somewhere, such as with GuardianDB

tarzan commented 6 years ago

I think I'm having similar issues.

From the README:

# remove from session (if fetched) and revoke the token
conn = MyApp.Guardian.Plug.sign_out(conn)

However, revoke is indeed never called. So, that seems to be an error in the documentation.

I am trying to hook up GuardianDB and follow the instructions there. It instructs to just put the GuardianDB interface on the on_revoke-hook like this:

  def on_revoke(claims, token, _options) do
    with {:ok, _} <- Guardian.DB.on_revoke(claims, token) do
      {:ok, claims}
    end
  end

In my app I just call the MyApp.Guardian.Plug.sign_out(conn) and the on_revoke is never triggered, therefore never deleting a persisted token in the database...

@doomspork would a PR fixing this be appreciated? Or is this wanted behaviour?

doomspork commented 6 years ago

@tarzan please do open a PR 👍

tarzan commented 6 years ago

Should be solved by #458.

dsazup commented 6 years ago

Hey guys, didn't want to open a new issue for this, but even after reading PR by @tarzan and installing guardian 1.01, the revoke callback is never called for me. I'm wondering what am I missing. Can you guys confirm it's actually being called? thanks

Edit: I think I got confused, looks like that stuff was not released yet.. When can we expect a release?

doomspork commented 6 years ago

@mirago we wanted to package up some other changes but we can cut a release with these changes 👍

In the meantime you can do: {:guardian, github: "ueberauth/guardian"}

dsazup commented 6 years ago

thanks for your reply, I will wait for the release, until then I am calling revoke manually and all works perfectly. 👍