parity(auth): add dispose() method + AuthRefreshDiscardedError for lockless coordination [from supabase-js]

Open
#258 1 comment 0 reactions 1 assignee View on GitHub

@Tr00d is already working on this.

Since Jul 1, 2026.

Assessment

This issue has not been assessed yet.

Description

parity

SDK Parity: C# implementation needed

Reference Implementation (supabase-js)

  • Commit: 54ec2b6
  • PR: #2392
  • Module: auth
  • Type: new-feature + deprecation
What Changed
  1. New Dispose() method on auth client — explicitly stops auto-refresh and cleans up state. Implements IDisposable / IAsyncDisposable.

  2. New AuthRefreshDiscardedError — returned when a token refresh succeeded server-side but tokens were discarded because the local session changed mid-flight (e.g., concurrent SignOut).

  3. lock option deprecated — removed in v3.

Code Reference
async dispose(): Promise<void>  // stops auto-refresh

class AuthRefreshDiscardedError extends AuthError {
  name = 'AuthRefreshDiscardedError'
}

Implementation Guidance (C#)

// Implement IDisposable and/or IAsyncDisposable
public class Client : IDisposable {
    public void Dispose() {
        // Cancel refresh timer
        // Clear session
    }
}

// New exception
public class AuthRefreshDiscardedException : Exception { ... }

Acceptance Criteria

  • Dispose() / DisposeAsync() method stops auto-refresh
  • AuthRefreshDiscardedException added
  • IDisposable interface implemented

Context


Generated with Claude Code /sync-sdk-parity

Dominant language
C#
Stars
701
Forks
106
Avg merge
16h 35m
Merged PRs (30d)
45

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from supabase/supabase-csharp

All issues in supabase/supabase-csharp

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.