I'm using this code (in an async function):

let about = await fetch("https://api.stackexchange.com/2.2/me?order=desc&access_token="+token+"&sort=reputation&site=gaming&filter=!)scMKI1zXS19EMMxEj7e");

but I'm getting a 400 Bad Request error. I have gotten access, I have accepted the app and then recorded the data.access_token, which is what token is (I have checked that the token looks right, it is).

I used this API help page to generate it. I've spent a bunch of time trying to figure this out, but I can't even find any examples.

What am I doing wrong?

1 Answer 1


An access_token is not enough; you need to specify a value for key as well. You can find it in the entry for your app here, this is how it looks like for one of mine:

enter image description here

I'm not sure how it works in JavaScript, but in cases like yours the API will send error details in the body; your library may ignore it by default if the HTTP code indicates an error, but it's still worth looking at.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .