createManagementClient function
Create a new ManagementServiceClient to access the Management 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 = createManagementClient('api.zitadel.ch');
Client with static access token:
final client = createManagementClient(
'api.zitadel.ch',
metadataProviders: [accessTokenProvider('token')],
);
Client with service account access token:
final client = createManagementClient(
'api.zitadel.ch',
metadataProviders: [
serviceAccountProvider(
'https://audience.zitadel.ch',
serviceAccount,
AuthenticationOptions(apiAccess: true),
),
],
);
Implementation
ManagementServiceClient createManagementClient(String apiEndpoint,
{int port = 443,
Map<String, String>? metadata,
Iterable<MetadataProvider>? metadataProviders,
Iterable<ClientInterceptor>? interceptors}) =>
_createClient(
apiEndpoint,
ManagementServiceClient.new,
port: port,
metadata: metadata,
metadataProviders: metadataProviders,
interceptors: interceptors,
);