I've been trying to get Laravel Airlock to work with a new web app I'm developing but no matter what I try, I can't get it to work.
airlock.php has the following set:
'stateful' => ['https://control.domain.tld',
'https://management.domain.tld',
'localhost'],
cors.php has:
'paths' => ['api/*', 'login', 'airlock/csrf-cookie'],
'supports_credentials' => true,
My .env has:
SESSION_DRIVER=cookie
session.php has:
'domain' => env('SESSION_DOMAIN', null),
In my Vue app I'm running this Axios request but I keep getting CSRF token mismatch.
axios.get('https://controlapi-v2.domain.tld/airlock/csrf-cookie').then(response => {
console.log(response);
});
I've followed all the guides online with zero luck. What could I be missing here?
The stateful variable in airlock.php has 3 URL's as my app will be on 2 domains and on localhost for development and testing. I've only tried this on localhost at the moment and am wondering whether this is causing the issue.
If I change localhost to http://localhost I no longer get CSRF token mismatch but there's when I check Chrome dev tools, there's no cookie set.
I've also read that the SPA has to be on the same subdomain as the API for Airlock to work. Is this true?