if you temporarily remove the middleware from the post route, does it reach your controller?
Laravel Sanctum: 403 This Action is Unauthorised
Trying to stay calm. But really, the quality of documentation in the Laravel space is doing my head in.
So I have created a vanilla laravel jetstream/livewire app. I made no decisions myself, just took every default offered to me. I have been using breeze for a few years, so it was time to upgrade my knowledge and app capability.....
So I made some migrations, got some tables up, seeded my standard user I use for testing, and then went and build a data entry form. Copying the pattern from the default dashboard route in the scaffolding, I created a route to my data entry page like this...
Route::middleware(['auth:sanctum', 'verified'])->get('/enter-trade', [TradeController::class, 'create'])->name('enter-trade');
Completely unremarkable. I login to the login page that comes with the scaffolding, press the button I added in, it calls this route, page is displayed. All as you would expect.
I then create an end point in my TradeController to accept the post from the form and copy the existing route and change it to....
Route::middleware(['auth:sanctum', 'verified'])->post('/save-trade', [TradeController::class, 'store'])->name('save-trade');
Basically the same, just a post instead of a get. Except that it constantly, returns,
403 This Action is Unauthorised
I have read things, watched videos on here, done it all... somehow, this just seems to be not working and I can't figure it out.
The only config I have done apart from what came out of the box, is adding two things, the first in resources/js/bootstrap.js
window.axios.defaults.withCredentials = true;
and in cors.php I changed false to true
'supports_credentials' => true,
In the immortal words of Princess Leia... "Help me Laracasts, you're my only hope".....
Please or to participate in this conversation.