Table of Contents

Method CreateApiKey

Namespace
Zedal.Sdk.Apis.Core
Assembly
Zedal.Sdk.dll

CreateApiKey(string, string, IEnumerable<string>, DateTimeOffset?, ZedalCallContext)

Creates an API key for the calling account. The key is returned only here and can never be retrieved again — store it as a secret. Requires scope usermgt.

Task<(string keyId, ApiKey apiKey)> CreateApiKey(string password, string description, IEnumerable<string> scopes, DateTimeOffset? expiresOn = null, ZedalCallContext context = default)

Parameters

password string

the current password of the calling account. A key outlives the session, so creating one needs the password again. A wrong password fails with InvalidArgument, the session stays valid.

description string

a name to recognize the key later.

scopes IEnumerable<string>

every scope the key may grant, see ApiKeyScopes. An empty list creates a key without scopes, which only identifies the account.

expiresOn DateTimeOffset?

optional expiry; without it the key does not expire.

context ZedalCallContext

Optionale Deadline-/Cancellation-Steuerung; ohne Angabe gilt der Client-Default.

Returns

Task<(string keyId, ApiKey apiKey)>

the id of the key for RevokeApiKey(string, ZedalCallContext) and the key itself.