korzhik
08/04/2026, 1:48 PMzedtoken in a microservice architecture when permissions are granted/revoked by admins?
For granting permissions, there is no big problem. You can grant the permission in one service and eventually send the zedtoken to another service or store it in a DB. It is acceptable if the user gets access a couple of seconds later.
But what happens when we remove/revoke a permission? Revoking a permission should ideally take effect immediately.
Imagine an admin revokes a user's permission in one service/pod. We then need to propagate the corresponding zedtoken to the service handling the user's queries as quickly as possible.
If everything is handled within one microservice, we have the problem of storing the zedtoken in two databases (SpiceDB and our DB). Potentially, we could lose the latest zedtoken if our DB transactions fail.
If the permission management and user queries are handled by different microservices, we have the same persistence problem, plus eventual consistency. We need to somehow transfer the zedtoken to another microservice, which could take some time depending on the implementation (Kafka, etc.).
So, in this case, understanding whether a relation was deleted by an admin is not immediately possible unless we use fully_consistent for such queries.
Am I missing something here? Is there a recommended pattern for handling zedtoken propagation in this kind of architecture, especially when permission revocation needs to take effect immediately?
Thanks in advance.yetitwo
08/04/2026, 4:32 PMkorzhik
08/05/2026, 7:28 AMyetitwo
08/05/2026, 12:15 PMyetitwo
08/05/2026, 12:15 PMyetitwo
08/05/2026, 12:16 PMyetitwo
08/05/2026, 12:17 PMkorzhik
08/05/2026, 1:15 PMkorzhik
08/05/2026, 1:16 PMkorzhik
08/05/2026, 1:18 PMfull_consistency to ensure the latest state is read immediately.
On the other hand, when we're granting permissions, using a ZedToken seems sufficient, since it's usually acceptable if access becomes available a little later.
This wording makes the distinction between revocation (security-critical) and granting (latency-tolerant) much clearer.yetitwo
08/05/2026, 1:35 PMyetitwo
08/05/2026, 1:35 PMyetitwo
08/05/2026, 1:36 PMkorzhik
08/05/2026, 1:50 PMyetitwo
08/05/2026, 1:55 PMyetitwo
08/05/2026, 1:56 PMyetitwo
08/05/2026, 1:56 PMyetitwo
08/05/2026, 1:57 PMkorzhik
08/05/2026, 2:07 PMkorzhik
08/05/2026, 2:09 PMyetitwo
08/05/2026, 2:13 PMyetitwo
08/05/2026, 2:13 PMyetitwo
08/05/2026, 2:13 PMyetitwo
08/05/2026, 2:14 PMyetitwo
08/05/2026, 2:15 PMkorzhik
08/05/2026, 6:28 PMfull_consistency.
No matter which pattern you choose, you end up with the same fundamental problem: you're writing to two different data stores. You first call DeleteRelation in SpiceDB and receive a ZedToken, and then you somehow need to persist or propagate that token. Whether you use an outbox, Kafka, or any other approach, there will always be a window where the token hasn't been stored or delivered yet, because those operations can't be performed atomically.yetitwo
08/05/2026, 8:44 PMyetitwo
08/05/2026, 8:44 PMyetitwo
08/06/2026, 3:35 AMkorzhik
08/06/2026, 9:43 AMyetitwo
08/06/2026, 1:31 PM