-
-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in Log Viewer with Laravel 11.36.1: User Logged Out When Accessing URL #411
Comments
Hey @HENRIQUELOBO , please share your |
Hi, return [
]; "In Laravel 10, it was working perfectly. Today, I updated to Laravel 11, and this error started to appear." |
Hello @HENRIQUELOBO , from what i see, it is 403, the action is unauthorized. |
Where do you have the authorization gate defined, and is that service provider added to the Laravel 11 providers config? |
Hello, I use Gate in app/Providers/AuthServiceProvider.php and as I mentioned in Laravel 10 it worked perfectly, I used it for several years. After I updated, I got an unauthorized error, and even setting Gate::define('viewLogViewer', function (?User $user) { when accessing the URL and viewing the log, when returning to the application the user is logged out. |
Sounds like something session related. Something is resetting the session (and thus the user no longer being logged in). Was there no other changes since then? Do you interact with sessions in any way? Is the Log Viewer on the same domain as the main app? Is the app behind a load-balancer? |
There were no changes; the Log Viewer is on the same domain. The only change was the update to Laravel 11. In Laravel 10, it was working perfectly as configured. |
@HENRIQUELOBO I solved this with the help from #362 (comment) You need to set the api_stateful_domains as an array in the config, or a comma separated list in the .env with a key of LOG_VIEWER_API_STATEFUL_DOMAINS @arukompas What's happening with a default install in laravel 11, the user is found from the session when using the viewLogViewer gate on the initial page load, but the subsequent api calls don't have anything to identify the logged in user, and null gets passed to the gate closure instead of a user object. |
I am encountering an issue with the Log Viewer in Laravel 11.36.1. Whenever I attempt to access the Log Viewer URL, the user is logged out and a message appears stating, "Request failed with status code 403: This action is unauthorized." Additionally, no log files are displayed.
Environment:
Laravel Version: 11.36.1
PHP Version: 8.3.14
Database: MySQL 8.0.23
Operating System: Ubuntu 20.04
The text was updated successfully, but these errors were encountered: