ueberauth / guardian_db

Guardian DB integration for tracking tokens and ensuring logout cannot be replayed.
MIT License
367 stars 87 forks source link

Ecto.StaleEntryError when using Guardian.DB.on_revoke #132

Closed sbinlondon closed 1 year ago

sbinlondon commented 3 years ago

In looking up this issue I found https://github.com/ueberauth/guardian_db/issues/102 and saw that it had been fixed, closed, and merged. But then the code that solved this was refactored in https://github.com/ueberauth/guardian_db/commit/781d0760170f69a2ee550d4371f6924d46bf74d9, removed, and never actually released.

We get tons of Ecto.StaleEntryErrors when using Guardian.DB.on_revoke. Was this written out by mistake, or was there a reason for removing it? Do you have any advice on how to fix this?

yordis commented 3 years ago

It seems to be a mistake. We are in the middle of doing a lot of refactoring, here is the file with all the Ecto integration: https://github.com/ueberauth/guardian_db/blob/master/lib/guardian/db/adapter/ecto.ex

sbinlondon commented 3 years ago

Good to know, thank you! 😊 Do you think it will be in the next release, whenever that is?

yordis commented 3 years ago

I am not sure, also we need to add back the line of code that fixes your issue if I am not mistaken.

alexfilatov commented 3 years ago

@sbinlondon haven't tested, but I think if you make guardian_db deps from this repo master branch and put in the Guardian.DB config this line stale_error_field: :stale_token this should fix your issue. (assuming we passing config to the actual delete() function here https://github.com/ueberauth/guardian_db/blob/master/lib/guardian/db/token.ex#L74)

yordis commented 3 years ago

@alexfilatov you are right! 🚀

yordis commented 2 years ago

Hey folks, I got lost in terms of what suppose to be the follow-up work here 😄 , do you remember?

yordis commented 1 year ago

@alexfilatov any idea here?

alexfilatov commented 1 year ago

yeah, I believe no followup here, safe to close