GetClientInfoResponseDTO
Package: @nauth-toolkit/core
Type: DTO (Response)
Response data transfer object for client information extracted from the current request context.
- NestJS
- Express
- Fastify
import { GetClientInfoResponseDTO } from '@nauth-toolkit/nestjs';
import { GetClientInfoResponseDTO } from '@nauth-toolkit/core';
import { GetClientInfoResponseDTO } from '@nauth-toolkit/core';
Properties
| Property | Type | Required | Description |
|---|---|---|---|
ipAddress | string | Yes | Client IP address. Extracted from X-Forwarded-For, CF-Connecting-IP, etc. Returns 'unknown' if called outside request context. |
userAgent | string | Yes | User agent string from the request. Returns 'unknown' if called outside request context. |
deviceToken | string? | No | Device token for trusted device feature. Extracted from cookie (nauth_device_token) or header (X-Device-Token). |
deviceName | string? | No | Optional device name (if provided by client). |
deviceType | 'mobile' | 'desktop' | 'tablet'? | No | Optional device type (if provided by client). |
ipCountry | string? | No | Optional IP country (from geolocation, if available). |
ipCity | string? | No | Optional IP city (from geolocation, if available). |
ipLatitude | number? | No | Optional IP latitude (from geolocation). Used for impossible travel detection. |
ipLongitude | number? | No | Optional IP longitude (from geolocation). Used for impossible travel detection. |
platform | string? | No | Platform extracted from user agent (e.g., 'iOS', 'Android', 'Windows', 'macOS'). |
browser | string? | No | Browser extracted from user agent (e.g., 'Chrome', 'Safari', 'Firefox'). |
sessionId | number? | No | Current session ID (if available from authenticated request). Extracted from JWT token payload. |
userId | number? | No | Current user database ID (if available from authenticated request). Extracted from JWT token payload. |
sub | string? | No | Current user sub UUID (if available from authenticated request). Prefer over userId for audit trails. |
Example
{
"ipAddress": "192.168.1.100",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
"deviceToken": "device-token-123",
"deviceName": "My Laptop",
"deviceType": "desktop",
"ipCountry": "US",
"ipCity": "New York",
"platform": "Windows 10",
"browser": "Chrome",
"sessionId": 123
}