Using API Device (Login POST Request help)

Hello Team members and fellow users of the device API !

I’m facing an issue on which I spend pretty much time on it… I’m trying actually from my local (exemple: 192.168.50.17:5000) to login into the api by using the following adresse : “https://{ip adresss of my router }/api/login?username=${values.username}&password=${values.password}

It works, it returns a 200 status, but the fact is that the auth token is return in a cookie, and the setCookie can’t be done because the response header have the attribute SameSite=Lax.

So I’m kinda stuck at this point, any help could be great,

Best Regards,

Samuel, Careprod Developper

@yuckon49
Look at my scripts here:

It has login methods for both the published device api as well as the web api.

Hey @Jonathan_Pitts , thanks for your message first of all and also for the response you gave me.

I will check this and give you an answer when I try out your solution :slight_smile: :+1:

Hey @Jonathan_Pitts ! Thanks for the response you gave again, but this is not what I’m seeking.

But I appreciate the help you gave me, with your answer.

If I need to explain what I’m trying to do : I actually have a login form on my localhost address(which is this one : https://ip of my mac given by the router**:port of the router**/ which enable me to send the following POST request : https://id of my router/api/login?username=username value&password=password value

I’m using fetch, on a React environment, I recieve a 200 response, but there is a Set-Cookie header in the response can’t be done cause I have in this Set-Cookie the attribute SameSite=Lax.

I did some research and it appears that I can’t retrive the cookie containing my bAuth string until my localhost address isn’t the same of my router.

That’s how I’m actually stuck.

Best Regards,

Samuel, Careprod Developper

what is the ip of your laptop? What is the ip of the router?

I did some research and now it’s working, I use a proxy to do my requests :slight_smile: