Let's say I have a next js application which exists in a different domain that needs to call a laravel route. This route leads to a login page.
This is what I did on react side
const handleSubmit = async (e) => { e.preventDefault(); try { const result = await axios.get("http://localhost:5001/login", { headers: { // "content-type": "application/json", "x-api-signature": "my-secret-token", }, }); console.log(result); } catch (error) { console.log(error); } }; I am getting cors error on front end
// In Laravel auth.php
Route::get('login', [AuthenticatedSessionController::class, 'create']) ->name('login'); This route leads to a simple login page.