input('email'); $password = $request->input('password'); if (!$email || !$password) { Response::error('يرجى إدخال البريد الإلكتروني وكلمة المرور', 'VALIDATION_ERROR', 422); return; } try { $result = $this->authService->login($email, $password); // Set refresh token in HttpOnly cookie setcookie('refresh_token', $result['refresh_token'], [ 'expires' => time() + (60 * 60 * 24 * 7), 'path' => '/api/v1/auth/refresh', 'httponly' => true, 'samesite' => 'Strict', 'secure' => true ]); unset($result['refresh_token']); Response::json([ 'success' => true, 'data' => $result, 'message' => 'تم تسجيل الدخول بنجاح' ]); } catch (Throwable $e) { Response::error($e->getMessage(), 'AUTH_FAILED', 401); } } public function me(Request $request): void { Response::json([ 'success' => true, 'data' => $request->user ]); } }