diff --git a/src/Identity/IdentityServer/ClientStore.cs b/src/Identity/IdentityServer/ClientStore.cs index 310c0ce98..6fd64ec21 100644 --- a/src/Identity/IdentityServer/ClientStore.cs +++ b/src/Identity/IdentityServer/ClientStore.cs @@ -90,7 +90,12 @@ public class ClientStore : IClientStore private async Task CreateApiKeyClientAsync(string clientId) { - var apiKey = await _apiKeyRepository.GetDetailsByIdAsync(new Guid(clientId)); + if (!Guid.TryParse(clientId, out var guid)) + { + return null; + } + + var apiKey = await _apiKeyRepository.GetDetailsByIdAsync(guid); if (apiKey == null || apiKey.ExpireAt <= DateTime.Now) {