How to invalidate/refresh JWT server-side? #373
Unanswered
KazimirPodolski
asked this question in
Q&A
Replies: 1 comment 1 reply
You can't force clients to refresh their JWTs immediately, but one thing I imagine should work may be to implement these notifications in PowerSync. A primitive solution: Say you had a table storing user ids and an incrementing integer representing the "version" of their roles / app-specific metadata. Then:
For access control, note that this doesn't invalidate the old JWT immediately. So if e.g. the role of the user changes in a way that a user has access to fewer data afterwards, they can still see the older data set (with updates) until their old token expires (unless the client is cooperative and reconnects after comparing the version field). |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Let's look at the docs of Parameter Queries:
Let's say
app_metadataorroleor whatever in the JWT payload changed server-side, possibly via other user's interaction (i.e. it's not necessary a user did the change leading to their own current JWT change, it might have been a server-side effect).How to refresh the JWT for all affected clients?
All reactions