I am deploying my project to the server using CI/CD. However, after deployment, I sometimes encounter a 419 "Page Expired" error related to @csrf when trying to log in to the website.
My first question is: Why am I receiving this error after deployment, specifically when attempting to log in?
My second question is: Which artisan commands should I include in the POST_SCRIPT to prevent this issue? Currently, I am running the following commands:
mkdir -p ~/projectname/bootstrap/cache || true
mkdir -p ~/projectname/storage/framework || true
mkdir -p ~/projectname/storage/framework/cache || true
mkdir -p ~/projectname/storage/framework/sessions || true
mkdir -p ~/projectname/storage/framework/testing || true
mkdir -p ~/projectname/storage/framework/views || true
php ~/projectname/artisan storage:link
php ~/projectname/artisan optimize:clear
php ~/projectname/artisan optimize
php ~/projectname/artisan migrate --force