public async Task <AccessTokenResponse> LogInAsync(CredentialProxy credentials) { ValidateCredentials(credentials); var user = await _userModel.GetByEmailAsync(credentials.Email); if (user == null || !HasPasswordMatch(user.PasswordHash, credentials.Password)) { ThrowHttp.Unauthorized(ErrorMessage.CREDENTIAL_MISMATCH); } var claim = new Claim(ClaimTypes.Email, user.Email); var token = _accessTokenManager.CreateAccessToken(new[] { claim }); return(new AccessTokenResponse(token)); }