alyn jones
May 16, 2025
Auth/session not syncing on Laravel 12 – Waterhole creates user_id = null session and fails to detect logged-in user
Hi Waterhole team,
I'm using Waterhole v0.4.12 with Laravel 12.14.1.
Everything is installed and configured according to your official docs:
- Laravel guard is
web
App\Models\User
implementsAuthenticatesWaterhole
andHasWaterholeUser
toWaterholeUser()
returns a valid PendingUser- Waterhole's built-in auth is disabled (
auth.php
) - Session driver is
database
- SESSION_DOMAIN is
.kinksters.test
- Waterhole route prefix is
/forum
- Login override is done via
ForumRoutes::add()
as instructed
Repro Steps:
- Log in to the Laravel app via
/login
- Laravel session is created with
user_id = 2
- Visit
/debug-session
— showsauth_user: 2
and correct session key - Visit
/forum
- A new session is created with
user_id = null
- Waterhole does not detect the user and redirects to login
- Visiting
/login
returns to/dashboard
— infinite loop
What I've Tried:
- Rebinding user provider via
AppServiceProvider
- Creating middleware to manually sync session and log user in
- Manually booting session via a custom service provider
- Verified guard hashes (
login_web_xxx
) match via debug tools - Upgraded to Laravel 12 and cleared all caches
- All cookies and session IDs are shared correctly
- Session ID remains the same between
/
and/forum
Expected:
Waterhole should recognize the logged-in Laravel user and auto-link/create the corresponding wh_users
record.
This seems to be caused by Waterhole accessing the auth guard before Laravel has fully restored the session (especially under the Laravel 11+/12 bootstrap/app.php
lifecycle).
Any help or patch would be greatly appreciated. I can provide a minimal repro if needed.
Thanks for your hard work on Waterhole — it’s a fantastic project and I really want to use it in production.