Getting the Cookie Jar Used for Authentication


You want to access the cookie creator used by authentication.


Use the Auth::getCookieJar() method.

$cookies = Auth::getCookieJar();

Note if authentication isn't using cookies a RuntimeException will be thrown.


Usually you can just access the Cookie facade.

By default Laravel uses the same cookie driver for both the Cookie facade and the Auth facade. This means unless your application is explicitly setting the cookie jar, it's easier to use the Cookie facade when dealing with cookies.

comments powered by Disqus