AuditHistoryResponse
Package: @nauth-toolkit/client
Type: Interface
Paginated response containing authentication and security audit events.
import { AuditHistoryResponse } from '@nauth-toolkit/client';
Properties
| Property | Type | Required | Description |
|---|---|---|---|
data | AuthAuditEvent[] | Yes | Array of audit event records |
total | number | Yes | Total number of records matching query |
page | number | Yes | Current page number (1-indexed) |
limit | number | Yes | Number of records per page |
totalPages | number | Yes | Total number of pages |
Example
Fetching Audit History:
const history = await client.getAuditHistory({
page: 1,
limit: 20,
eventType: 'LOGIN_SUCCESS',
});
console.log(`Page ${history.page} of ${history.totalPages}`);
console.log(`Showing ${history.data.length} of ${history.total} events`);
history.data.forEach((event) => {
console.log(`${event.eventType} - ${event.eventStatus}`);
console.log(`IP: ${event.ipAddress}, Location: ${event.ipCity}, ${event.ipCountry}`);
console.log(`Device: ${event.deviceType} - ${event.browser}`);
});
Angular with Pagination:
this.authService
.getClient()
.getAuditHistory({
page: this.currentPage,
limit: 20,
})
.then((response) => {
this.events = response.data;
this.totalPages = response.totalPages;
this.totalRecords = response.total;
});
Filtering by Event Type:
// Get all failed login attempts
const failedLogins = await client.getAuditHistory({
eventType: 'LOGIN_FAILED',
page: 1,
limit: 50,
});
// Get suspicious activity
const suspicious = await client.getAuditHistory({
eventStatus: 'SUSPICIOUS',
page: 1,
limit: 100,
});
Related APIs
- NAuthClient.getAuditHistory() - Retrieve audit history
- AuthAuditEvent - Individual audit event structure
- AuthAuditEventType - Event type enum
- AuthAuditEventStatus - Event status type