diff --git a/src/Core/IdentityServer/BaseRequestValidator.cs b/src/Core/IdentityServer/BaseRequestValidator.cs index 9b6da5e4ec..7eb9052ad1 100644 --- a/src/Core/IdentityServer/BaseRequestValidator.cs +++ b/src/Core/IdentityServer/BaseRequestValidator.cs @@ -474,9 +474,15 @@ namespace Bit.Core.IdentityServer protected async Task KnownDeviceAsync(User user, ValidatedTokenRequest request) => (await GetKnownDeviceAsync(user, request)) != default; - protected async Task GetKnownDeviceAsync(User user, ValidatedTokenRequest request) => - await _deviceRepository.GetByIdentifierAsync(GetDeviceFromRequest(request).Identifier, user.Id); + protected async Task GetKnownDeviceAsync(User user, ValidatedTokenRequest request) + { + if (user == null) + { + return default; + } + return await _deviceRepository.GetByIdentifierAsync(GetDeviceFromRequest(request).Identifier, user.Id); + } private async Task SaveDeviceAsync(User user, ValidatedTokenRequest request) { var device = GetDeviceFromRequest(request);