C#: Supply an access token from a callback

Supplies the access token for Database, Storage and Edge Functions requests from an async callback. The callback is awaited before every request and its token is sent as Authorization: Bearer. Use it with a third-party auth provider such as Clerk, Auth0, Firebase or Cognito.

Examples

With the Supabase client

var options = new Supabase.SupabaseOptions
{
    ThirdPartyAccessToken = cancellationToken => clerk.GetTokenAsync(cancellationToken)
};

var supabase = new Supabase.Client(url, key, options);
var result = await supabase.From<City>().Get();

With a standalone Postgrest client

var client = new Supabase.Postgrest.Client(url, new Supabase.Postgrest.ClientOptions
{
    RetrieveAccessToken = cancellationToken => tokenStore.GetTokenAsync(cancellationToken)
});