I get an error 419 every time I try to login or register a user in Laravel 8 hosting. What could it be?
I uploaded my laravel 8 project to hosting, it worked perfectly locally but hosting gives me this error. I use the forms that laravel provides for authentication so everyone has the @csrf directive, as well as verify that the storage folder has recursive permissions 777. The hosting has installed php 7.4
And I still can't solve this error, it caught my attention is that the files that are created in the / storage / framework / session folder when trying to log in have 644 permissions. Besides, I also have another problem, the routes that are outside the middleware auth do not load but redirect me back to login. Comment the \ App \ Http \ Middleware \ VerifyCsrfToken :: class in Kernel.php and I pass the same when I start the session I am redirected again to the login view, so if there is any problem with the token but also with the routes, I have searched in many forums and so far I have not gotten a solution to this.
@nievesandres It sounds like for some reason, the session cookies aren't being set, and that's why you're getting a 419 and getting redirected back to the login screen.
What browser are you using, and have you tried a different one? Is your site name in the .env file set to the correct domain that you're hosting this website on?
@aschmelyun use Chrome, Firefox and operates obtaining the same behavior. I created a subdomain in the hosting for the project, I have SESSION_DOMAIN configured with the subdomain, the whole project is in a folder and the subdomain points to the public folder of the project