I'm having exactly the same problem as Álvaro did here:
Check Laravel 5.7 login from external script
I had an external script I've not used since upgrading to 5.7 with the cookies encryption and now it's not working on POST requests, just GET.
I've tried the Route::any('/'
... trick in his own answer, however, I can't see where he's getting the $response
variable from in his sample code either - and I've tried disabling both:
\App\Http\Middleware\EncryptCookies::class,
\App\Http\Middleware\VerifyCsrfToken::class,
from the Http\Kernel
In regards to my code - it's pretty much exactly the same as his - and isn't working:
require_once __DIR__.'/../../../vendor/autoload.php';
$app = require_once __DIR__.'/../../../bootstrap/app.php';
$app->make('Illuminate\Contracts\Http\Kernel')
->handle(Illuminate\Http\Request::capture());
$isAuthorized = Auth::check();
if(!$isAuthorized){
echo "Not Authorized";
exit();
}
Seemed to have hit a dead end with this one so any advice towards a fix or even the mysterious $response
would be greatly appreciated!
Edit/Update:
Interestingly, I have a Route::fallback()
within my routes/web.php and removing that causes auth to fail on the external GET request too, so it may actually be associated with Routing and it not being loaded from within the Laravel app router provider?