Skip to content

User is not available #491

Open
Open

Description

@dmitryBuzz

In all API requests, such as log-viewer/api/folders etc., the User is not available, so if I check user in

        LogViewer::auth(function ($request) {
            $user = $request ? $request->user() : auth()->user();
        });

or

 Gate::define('viewLogViewer', function (?User $user) {
        // return true if the user is allowed access to the Log Viewer
    });

The user is null. Which makes it impossible to use "Authorizing access to Log Viewer".

Activity

  1. bilogic commented on Jan 21, 2026

    @bilogic
    Image

    Yea precisely, the offending route is /log-viewer/api/folders?direction=desc, it needs to use the web middleware and not its own ones otherwise I don't see a way to ACL/secure it properly in production.

  2. arukompas commented on Feb 28, 2026

    @arukompas
    Contributor

    hey @dmitryBuzz , did you set the correct APP_URL and LOG_VIEWER_API_STATEFUL_DOMAINS environment variables? The API endpoints don't get authorized if the requests come from unauthorized/unconfigured domain.

    See here: https://log-viewer.opcodes.io/docs/3.x/configuration/route-and-domain#production-domains

    @bilogic The session/cookies middleware is started by the EnsureFrontendReqeustsAreStateful dymanically based on whether the calling domain is allowed access. See the above documentation link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions