I would suppose your login page is sitting idle for an extended period. You could get that page to refresh automatically every N seconds (within the Session lifetime) , e.g.
@vincent15000 no, it will be the same Session if the lifetime has not already expired; otherwise it will be a new Session. This solution is intended to add the meta tag only on the login page.
Why, are you worried about keeping an authenticated user session alive? I would expect the Illuminate\Auth\Middleware\RedirectIfAuthenticated to prevent authenticated users being able to visit the login page in the first case.
@tykus I worry about this because it happened today with an application that I'm developing (it will be in production in March). I think that I have logged in, then I let the page inactive for 3 hours and I got this error.
@Snapey Thank you for your answer ... well ... your article is very interesting.
Is your solution a valid solution even if, for example, I log in, then I don't log out, but I just turn off my computer and in some 6 hours I turn it on and I try to log in ?
@vincent15000 when you turn on your computer you have no session, until you load the web page, then you have a session and a valid csrf token, so with or without the suggested code, this is not an issue, and is the same as you accessing the site for the very first time