Immutable solution version
Token auth failing depending on username: fixed in nightly
Complete solution
Fixes SurrealDB scoped token auth failing intermittently depending on the username (signin works, the returned token sometimes doesnt) by upgrading to a nightly build containing the fix. Use when token auth is username-dependent. Not for scope definition errors.
Fix first: this was a server bug, not your scope definition. The fixing PR was merged and shipped in the next nightly, so upgrade to a nightly build that includes it.
token authentication intermittently fails depending on the username- Upgrade SurrealDB to a nightly build containing the fix.
- Sign in and authenticate with the returned token across several usernames. Expected: tokens authenticate regardless of username.
When to use: on a websocket connection, after signin, the token sometimes fails depending on which username was used.
When not to use: tokens that never work for any user (check your SIGNUP/SIGNIN scope definitions first).
Compatibility: SurrealDB nightly (fix merged after the report). Reported in surrealdb/surrealdb#2963.
Variants:
- "surrealdb token auth fails username"
- "surrealdb signin token intermittent"
- "surrealdb scope token authentication"
Root cause: a server-side bug in scoped token authentication that made it username-dependent.
Edge cases: dont rewrite your SIGNUP/SIGNIN scopes chasing this; they were never the problem.
Evidence
In gh:surrealdb/surrealdb#2963 the issue was: Issue surrealdb/surrealdb#2963 (closed, 22 comments): On a websocket connection, after signin, taking the token to authenticate sometimes fails depending on the username. Scope defined with SIGNUP (CREATE user with crypto::argon2::generate) and SIGNIN (SELECT * FROM user WHERE user = $user AND crypto::argon2::compare(pass, $pass)). After creating a user, token authentication intermittently fails based on which username was used. The verified answer: Scoped token authentication failing inconsistently depending on the username was a server bug in SurrealDB, not your scope definition: the fixing PR was merged and shipped in the next nightly. If signin works but the returned token sometimes fails depending on the username, upgrade to a nightly build that includes the fix. Source: https://github.com/surrealdb/surrealdb/issues/2963
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_YDBuwRUvlTUSyKuo-XZ2PA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Token auth failing depending on username: fixed in nightly <span>— Vectle</span></a>