Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mussy's avatar
Level 1

JWT and post request problem

Hi pals, I've a problem with laravel. I use jwt and face with problem while sending my request to server. I send data by POST method but server receive them by GET method. I tried it in my local and it works great but in shared host has problem. All routes have been defined in api.php file. PS: jwt with no request has no problem

0 likes
3 replies
bobbybouwmann's avatar

There is probably something wrong with your frontend code. Can you post the code that is sending the request here?

mussy's avatar
Level 1
fetch(`URL`, {
            method: "POST",
            headers: {
                authorization: `Bearer ${TOKEN}`,
                "Content-Type": "application/json"
            },
            body: JSON.stringify(body)
 })

I'm using fetch in js

mussy's avatar
Level 1

Does anyone have a solution?

Please or to participate in this conversation.