diff options
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 + }; } } |
