The question is not clear enough. You appear to be trying to use jQuery to do *explicit* OAuth from a web page. If so, **this is not allowed.** Explicit OAuth is for servers. You are not running that code in node.js are you? **Anything that runs in the user's browser, like javascript, needs to use ["implicit" (Client side) OAuth][1].** Implicit OAuth was developed for that purpose. [This answer][2] gives the **setup and steps needed** to use the implicit (Client side) OAuth flow. [This answer][3] gives working code to **implement implicit OAuth in a userscript**, if you are trying to do that. (Not the same as a web page's javascript.) ---------- ---------- **If you have your own server**, and control the webpage(s), then you *would* use explicit OAuth. But you need to do it properly (no client-side AJAX for the OAuth bits). That includes: when your **server** POSTS to `stackexchange.com/oauth/access_token` it must do it as though it is browsing that page. [1]: https://api.stackexchange.com/docs/authentication [2]: https://stackapps.com/a/7010/7653 [3]: https://meta.stackexchange.com/a/293498/148310