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

santiagoScantamburlo's avatar

Make an API request to Inertia App

Hi everyone. I'm trying to make a login via API to my application. This is because there's a main system that manages a big amount of apps by redirecting to them and making the login through their respective API's before redirecting. This applications are made with Laravel and JWT, but now I'm trying to make one with Inertia as testing and can't make it to work. What I want to do is: send the credentials to the endpoint and get back the cookies or a token that I can send through parameters to the application that I'm redirecting to, to automatically make the login and don't redirect to the login page. Is there a way to make it? Now I'm testing with Postman just to make sure that the login through the API works, but no results yet.

0 likes
1 reply
FOliveira's avatar

with inertia it is not possible to receive a return, I advise you to do the same with axios

https://axios-http.com/ptbr/docs/api_intro

like this one:

  axios({
    method: "post",
    url: "https://yourdomain.com/api/your-endpoint",
    data: {
      username: "user",
      password: "pass",
    },
  }).then((response) => {
    console.log(response);
  });

Please or to participate in this conversation.