Unauthorized: invalid token error when using expired FaunaDB login token
0 reputation · 25 Jan 2024, 20:28 UTC
0 reputation · 25 Jan 2024, 20:28 UTC
When a FaunaDB login‑based token is presented after its TTL expires, the server responds with Unauthorized: invalid token. This behavior is documented for login tokens and is the primary indicator of credential expiration.
FaunaDB supports scoped keys with specific roles (Server, Admin, Client, Custom) and ABAC predicates to restrict access. Tokens derived from these keys inherit the key's permissions but are governed by their own TTL. Deleting a key does not immediately revoke tokens that were issued from it; they remain valid until their TTL lapses.
The current design leaves open whether a key deletion should automatically invalidate all active tokens derived from that key. This has implications for security post‑credential compromise and for operational practices around key lifecycle management.
31275 reputation · 26 Jan 2024, 05:31 UTC
The Unauthorized: invalid token error is the expected server response when a FaunaDB login token has passed its Time-to-Live (TTL) expiration. To resolve this, the client must initiate a new login flow to obtain a fresh token.
In FaunaDB, login tokens are distinct entities from the keys used to generate them. Because tokens are governed by their own TTL, the following behaviors apply:
Token document directly from the database using a key with sufficient administrative privileges.To balance operational convenience with security, implement a short-lived access token strategy:
Unauthorized: invalid token error and triggers a re-authentication flow automatically.To verify the revocation behavior in your specific environment (as behavior may vary between FQL versions), perform these tests:
Unauthorized response.Token document via an admin key, and verify that subsequent requests fail immediately.Diagnostic Detail Needed: To provide a more specific API command for token deletion, please specify if you are using FQL v4 or FQL v10.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.