owl — 11/4/2023, 6:07:24 AM

@wully i think ur api docs for wasteof 2 regarding getting token is outdated

♥ 3 ↩ 0 💬 19 comments

comments

oren:

can confirm, it is still the same

11/4/2023, 3:25:12 PM
asfsdgdfd:

it’s not

11/4/2023, 12:34:09 PM
lily:

it’s @wulliy and no, i’m pretty sure getting the token is still the same

11/4/2023, 11:16:19 AM
lily:

wait no it’s @wuilly i think

11/4/2023, 11:16:58 AM
doey:

hi

11/4/2023, 5:25:30 PM
lily:

hi wuilly

11/4/2023, 6:04:30 PM
owl:

wait but it just returns {}?

11/7/2023, 1:16:19 PM
lily:

wait what the fuck

you should get either {"token":"<token>"} or {"error":"<error>"}, you can’t get {} from any endpoint that i’m aware of

11/7/2023, 1:42:23 PM
owl:

here ill show you an image later

11/7/2023, 1:45:50 PM
owl:
11/7/2023, 10:49:39 PM
lily:

needs to be json not form-data

11/7/2023, 11:16:23 PM
owl:

im an idot

11/8/2023, 1:38:12 PM
owl:

how the fuck u do that

like whats the json format

11/9/2023, 1:41:33 AM
owl:
11/9/2023, 1:55:24 AM
lily:

it needs to be in an object (you’re missing {} around it)

also the Content-Type header must be set to application/json (libraries that allow JSON POST data usually do this automatically but a request maker like that or curl usually don’t)

11/9/2023, 9:37:25 AM
owl:
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "username": "mrowlsss",
  "password": "password"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("api.wasteof.money/session/", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

returns {}

11/9/2023, 3:12:02 PM
lily:

i have no idea what’s going wrong

for me, if you don’t send json data you get {"error":"must send json data"}, and once i fixed it it said {"error":"incorrect username or password"} (obviously). cc @jeffalo since wuilly’s on his break — do you know what’s wrong here?

11/9/2023, 4:05:05 PM
jeffalo:

works fine for me. maybe change it to be https://api.wasteof.money @mrowlsss? because without the https:// it will be a relative request and idk how that works in nodejs, but in the browser it makes a request to the current domain slash that

11/9/2023, 8:08:30 PM
owl:

ah, ill see if that works

11/9/2023, 10:29:51 PM