Get Session Information
Fetch the current authenticated user's session information.
Overview
The Session::current() method retrieves details about the currently authenticated user. If no valid session exists (i.e., the user is not logged in), the API returns a 404 error.
Usage
Basic Usage
Retrieve the current user's session information:
php
use ThingsTelemetry\Traccar\Facades\Session;
$user = Session::current();With Token Verification
Optionally pass a token to verify its validity:
php
use ThingsTelemetry\Traccar\Facades\Session;
$token = 'abc123...';
$user = Session::current($token);Result
The response is an instance of ThingsTelemetry\Traccar\Dto\UserData.
php
$user->id; // 42
$user->name; // "Jane Doe"
$user->email; // "jane@example.com"
$user->administrator; // true|false
$user->map->value; // "osm"
$user->coordinateFormat; // enum CoordinateFormat
$user->expirationTime?->toIso8601String();
$user->attributes->toArray(); // array<string, mixed>Key Result Fields
id→int- Unique user identifiername→string- User's full nameemail→string- User's email addressadministrator→bool- Whether the user has admin privilegesmap→Map- Preferred map providercoordinateFormat→CoordinateFormat- Preferred coordinate formatattributes→UserAttributesData- Additional user attributes
IMPORTANT
Refer to the UserData DTO documentation for complete field documentation.