The standalone Postgrest, Storage, and Functions clients accept an async RetrieveAccessToken callback in their options. It supplies the bearer token for every request, so you do not need to call SetAuth() after each refresh.
Func<CancellationToken, Task<string?>>.null token leaves the headers unchanged.Authorization header.Supabase.Client, use SupabaseOptions.ThirdPartyAccessToken, which wires this callback into each client for you.var options = new Supabase.Postgrest.ClientOptions
{
RetrieveAccessToken = async cancellationToken => await tokenStore.GetAccessTokenAsync(cancellationToken)
};
var postgrest = new Supabase.Postgrest.Client("https://<project>.supabase.co/rest/v1", options);
var options = new Supabase.Storage.ClientOptions
{
RetrieveAccessToken = async cancellationToken => await tokenStore.GetAccessTokenAsync(cancellationToken)
};
var storage = new Supabase.Storage.Client("https://<project>.supabase.co/storage/v1", options);
var options = new Supabase.Functions.ClientOptions
{
RetrieveAccessToken = async cancellationToken => await tokenStore.GetAccessTokenAsync(cancellationToken)
};
var functions = new Supabase.Functions.Client("https://<project>.supabase.co/functions/v1", options: options);