diff options
| author | iven <99438726+ivenos@users.noreply.github.com> | 2026-10-07 18:47:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-10-07 18:47:59 +0200 |
| commit | bda7ffaae83ab4942f5dcb2aab628d91180f375f (patch) | |
| tree | 754543f122a471e4efa831458f9bf53a27dc5b42 /Jellyfin.Server.Implementations/Security/AuthenticationManager.cs | |
| parent | dbd42958531101aac4afaa03d456fc373f048b86 (diff) | |
Return the created API key from POST /Auth/Keys (#17155)
* Return the created API key from POST /Auth/Keys
* Keep the other API key fields in the DTO
Diffstat (limited to 'Jellyfin.Server.Implementations/Security/AuthenticationManager.cs')
| -rw-r--r-- | Jellyfin.Server.Implementations/Security/AuthenticationManager.cs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs b/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs index cf0293463f..2bc7b9f915 100644 --- a/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs +++ b/Jellyfin.Server.Implementations/Security/AuthenticationManager.cs @@ -23,14 +23,25 @@ namespace Jellyfin.Server.Implementations.Security } /// <inheritdoc /> - public async Task CreateApiKey(string name) + public async Task<AuthenticationInfo> CreateApiKey(string name) { var dbContext = await _dbProvider.CreateDbContextAsync().ConfigureAwait(false); await using (dbContext.ConfigureAwait(false)) { - dbContext.ApiKeys.Add(new ApiKey(name)); + var apiKey = new ApiKey(name); + dbContext.ApiKeys.Add(apiKey); await dbContext.SaveChangesAsync().ConfigureAwait(false); + + return new AuthenticationInfo + { + AppName = apiKey.Name, + AccessToken = apiKey.AccessToken, + DateCreated = apiKey.DateCreated, + DeviceId = string.Empty, + DeviceName = string.Empty, + AppVersion = string.Empty + }; } } |
