Skip to content

Commit

Permalink
only fail awaiting token confirmation for valid auth response
Browse files Browse the repository at this point in the history
  • Loading branch information
erquhart committed Jan 23, 2025
1 parent 3f46b0a commit 49f2261
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/browser/sync/authentication_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,17 @@ export class AuthenticationManager {
}

onAuthError(serverMessage: AuthError) {
// If auth error comes from a query/mutation/action and the client
// is waiting for the server to confirm a token, ignore.
// TODO: This shouldn't rely on a specific error text, make less brittle.
// May require backend changes.
if (
serverMessage.error === "Convex token identity expired" &&
(this.authState.state === "waitingForServerConfirmationOfFreshToken" ||
this.authState.state === "waitingForServerConfirmationOfCachedToken")
) {
return;
}
const { baseVersion } = serverMessage;
// Versioned AuthErrors are ignored if the client advanced to
// a newer auth identity
Expand Down

0 comments on commit 49f2261

Please sign in to comment.