What is Laravel's $request->session()->regenerateToken() method used for?

Viewed 55

I'm checking my Laravel's logout form and noticed this line of code in Laravel documentation website:

"In addition to calling the logout method, it is recommended that you invalidate the user's session and regenerate their CSRF token. "

And then use this method $request->session()->regenerateToken();

Since it does not say anything else about this CSRF token regeneration, I was wondering why would I need to regenerate CSRF token if I am trying to log the user out?

0 Answers
Related