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

comments (single view)

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

here ill show you an image later

needs to be json not form-data

im an idot

how the fuck u do that

like whats the json format

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)

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 {}

See more replies
View all comments