Skip to main content

GetClientInfoResponseDTO

Package: @nauth-toolkit/core Type: DTO (Response)

Response data transfer object for client information extracted from the current request context.

import { GetClientInfoResponseDTO } from '@nauth-toolkit/nestjs';

Properties

PropertyTypeRequiredDescription
ipAddressstringYesClient IP address. Extracted from X-Forwarded-For, CF-Connecting-IP, etc. Returns 'unknown' if called outside request context.
userAgentstringYesUser agent string from the request. Returns 'unknown' if called outside request context.
deviceTokenstring?NoDevice token for trusted device feature. Extracted from cookie (nauth_device_token) or header (X-Device-Token).
deviceNamestring?NoOptional device name (if provided by client).
deviceType'mobile' | 'desktop' | 'tablet'?NoOptional device type (if provided by client).
ipCountrystring?NoOptional IP country (from geolocation, if available).
ipCitystring?NoOptional IP city (from geolocation, if available).
ipLatitudenumber?NoOptional IP latitude (from geolocation). Used for impossible travel detection.
ipLongitudenumber?NoOptional IP longitude (from geolocation). Used for impossible travel detection.
platformstring?NoPlatform extracted from user agent (e.g., 'iOS', 'Android', 'Windows', 'macOS').
browserstring?NoBrowser extracted from user agent (e.g., 'Chrome', 'Safari', 'Firefox').
sessionIdnumber?NoCurrent session ID (if available from authenticated request). Extracted from JWT token payload.
userIdnumber?NoCurrent user database ID (if available from authenticated request). Extracted from JWT token payload.
substring?NoCurrent 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
}

Used By