dflydev / dflydev-fig-cookies

Cookies for PSR-7 HTTP Message Interface.
MIT License
224 stars 29 forks source link

Slim 3 Middleware returns null for cookies #28

Closed mainawycliffe closed 7 years ago

mainawycliffe commented 7 years ago

Hi, i am using Slim 3 and i have a small issue here, the problem is when i use a middleware to retrieve a specific cookie, it returns an empty cookie but when i use the same method and class with a controller, it retrieves the same cookie without issue. I am using it to retrieve JWT package cookie, i am using a shared class that i inject into the container, which means the code refusing to work when called by a middleware is the same that works when called by a controller.

$jwtPackage = FigRequestCookies::get($request, $authenticationTokenCookieName)->getValue();

Please note i have not injected the dflydev-fig-cookies library into slim 3 containers and am also new to slim. Thanks.

mainawycliffe commented 7 years ago

Sorry, the issue came from when i was creating cookies and i didn't specify the cookie path. This led to it assuming the current path for authentication as the default and hence cookies were just sent to that path only.