const code = ** my authorization code ** ; const CLIENT_ID = ** my client id ** ; const CLIENT_SECRET = ** my client secret ** ; const creds = btoa(`${CLIENT_ID}:${CLIENT_SECRET}`); fetch(`https://discordapp.com/api/oauth2/token`, { method: "POST", headers: { Authorization: `Basic ${creds}`, }, body: JSON.stringify({ grant_type: 'authorization_code', code: code, redirect_uri: redirect }), }) .then((res) => res.json()) .then((body) => console.log(body));