How do you invalidate/persist tokens with ash_authentication?
JWT tokens by itself are stateless, meaning that you can't invalidate them if you do not store them.
Is there a way to do that with
ash_authentication
?1 Reply
Great question! There are options for this in the
tokens
DSL. THis is what it looks like in AshHq
There are other things you will likely want to do if you are doing this. These may be builtin at some point. In AshHq, we have a global change that we add to the resource that will remove all tokens when a user resets their password (thus logging out any other sessions).
Finally, you'll want to remove the token in your AuthController
where the user signs out (or however you're signing out if you've done something custom). This is what it looks like in AshHq
.
I'd like for this behavior to be built in as options eventually, but until then we have the tools to do what we want 😄