createAdminClient function
Create a new AdminServiceClient to access the Admin API of ZITADEL.
The client can be configured by adding default metadata and/or interceptors.
Also with the metadataProviders
one can add a list of providers that will
be called for each RPC call. For example, the provider may attach access tokens from static
or service account sources.
Example
Simple client:
final client = createAdminClient('api.zitadel.ch');
Client with static access token:
final client = createAdminClient(
'api.zitadel.ch',
metadataProviders: [accessTokenProvider('token')],
);
Client with service account access token:
final client = createAdminClient(
'api.zitadel.ch',
metadataProviders: [
serviceAccountProvider(
'https://audience.zitadel.ch',
serviceAccount,
AuthenticationOptions(apiAccess: true),
),
],
);
Implementation
AdminServiceClient createAdminClient(String apiEndpoint,
{int port = 443,
Map<String, String>? metadata,
Iterable<MetadataProvider>? metadataProviders,
Iterable<ClientInterceptor>? interceptors}) =>
_createClient(
apiEndpoint,
AdminServiceClient.new,
port: port,
metadata: metadata,
metadataProviders: metadataProviders,
interceptors: interceptors,
);