Skip to content

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 identifier
  • name → string - User's full name
  • email → string - User's email address
  • administrator → bool - Whether the user has admin privileges
  • map → Map - Preferred map provider
  • coordinateFormat → CoordinateFormat - Preferred coordinate format
  • attributes → UserAttributesData - Additional user attributes

IMPORTANT

Refer to the UserData DTO documentation for complete field documentation.

Released under the MIT License.