wish helps you I finally found an answer for that. The middleware responsible for starting sessions is not a global middleware,it is only in the web middleware group.Therefore,laravel was unable to access the session ,since my middleware was run before they were even started.
Can't import custom Middleware whilst using @decorator_from_middleware. (Non Global Middleware)
fixed the issue. Will look into that further This is standard Python behaviour. Unless you explicitly import AuthCheckMiddleware in the __init__.py of myapp.middleware, it won't be imported by from myapp.middleware import *. But really you should never be doing this anyway. There's very rarely a good reason to do import *; always import the things you need explicitly.
from myapp.middleware.authCheck import AuthCheckMiddleware
Pass object initialized via express middleware to next middleware
I hope this helps . Pass it via req or res depending on your intent. If the data relates to the request such as the requesting user's identity, the session attributes, geoIP or parsed request body then attach it to the req object: