I'm trying to authenticate myself but always get the error 404
const authResponse =
await (await fetch("https://reddit.com/api/v1/access_token", {
method: "POST",
headers: {
"Authorization": "Basic " + btoa("CLIENT-ID:CLIENT-SECRET"),
"user-agent": "MyApp/1.0.0",
},
body: JSON.stringify({
grant_type: "password",
username: "MY-USERNAME",
password: "MY-PASSWORD",
}),
})).json();
console.log(authResponse);
I've checked the password and the username and also the client id and the client secret but I still get the error 404. What am I doing wrong? I've followed an explanation from a Reddit post. Sadly I can't use any libraries so everything has to be done with Javascript fetch().