1

I am using Nextjs, for frontend and laravel for backend. My Login api works fine in postman, but in frontend it return 419 xhr error. What can I do to fix this?

export const postLogin = async (data: any) => {
    try {
        await axiosCrmClient.post("sanctum/csrf-cookie", {
            withCredentials: true,
        });
        const response = await axiosCrmClient.post("login", data, {
            headers: {
                Accept: "application/json",
                'Content-Type': "application/json",
            },
            withCredentials: true,
        });
        return response;
    } catch (err: any) {
        console.log(err);
    }
};
1
  • 1
    pls added to your backend .env SANCTUM_STATEFUL_DOMAINS=localhost,127.0.0.1,or your current domain Commented Jan 16 at 5:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.