Henara.MetabaseEmbed.Client 1.0.0

Henara.MetabaseEmbed.Client

Client for the Henara Metabase token service (gRPC). Exchanges the user's Keycloak access token for Metabase embed tokens and lists the dashboards the user may embed.

Setup

Sign-in is up to the host. Hand the Keycloak access token over with IKeycloakAccessTokenProvider:

public sealed class KeycloakAccessTokenProvider : IKeycloakAccessTokenProvider
{
    private readonly MyTokenStore _tokens;

    public KeycloakAccessTokenProvider(MyTokenStore tokens) => _tokens = tokens;

    public Task<string?> GetAccessTokenAsync(CancellationToken ct = default) => _tokens.GetAccessTokenAsync(ct);
}

Register it and the client. The options are bound from the host's IConfiguration, which reads the environment variables:

services.AddSingleton<IKeycloakAccessTokenProvider, KeycloakAccessTokenProvider>();
services.AddMetabaseEmbed(configuration);
Variable Description
METABASE_EMBED_GRPC_ADDRESS Token service address
METABASE_EMBED_TIMEOUT_SECONDS Deadline of each call in seconds
METABASE_INSTANCE_URL Browser-facing Metabase base URL

All are required. AddMetabaseEmbed validates them immediately and throws OptionsValidationException when one is missing or invalid, in any host (ASP.NET Core, MAUI, WPF, Windows Forms).

The optional second argument changes the options after binding, before validation:

services.AddMetabaseEmbed(configuration, options =>
    options.CreateHttpHandler = () => new GrpcWebHandler(GrpcWebMode.GrpcWeb, new HttpClientHandler()));

CreateHttpHandler sets the HTTP handler of the token service channel. Register an IGrpcAddressProvider before AddMetabaseEmbed to resolve the address at runtime.

Usage

Inject IMetabaseTokenProvider:

var dashboards = await tokenProvider.GetAccessibleDashboardsAsync();
var token = await tokenProvider.GetEmbedTokenAsync(databaseId, DashboardType.MeinePraxis);

Errors

Failures throw MetabaseTokenServiceException with the server's message and a Reason:

Reason Cause
NotAuthenticated No or an invalid Keycloak access token
PermissionDenied The user may not access the dashboard or database
InvalidRequest The request was rejected as invalid
NotConfigured The token service is missing configuration
Unavailable The token service could not be reached
Timeout The call exceeded the configured timeout
Unknown Any other failure

Cancelling the CancellationToken throws OperationCanceledException.

Showing the top 20 packages that depend on Henara.MetabaseEmbed.Client.

Packages Downloads
Henara.MetabaseEmbed.Core
The MetabaseDashboard component the Henara Metabase dashboard components render.
9
Henara.MetabaseEmbed.Core
The MetabaseDashboard component the Henara Metabase dashboard components render.
5

Version Downloads Last updated
1.1.0 9 10/30/2026
1.0.0 5 10/29/2026