title: Discord Ouath2 Access Token 'Grant type None is not supported'
body: <p>Im trying to make a login system with discord for my website that is made with express. I have made a function to get an access token so that I can use that function in the route.</p>
  <p>Im trying to get an access token from: <a href="https://discord.com/api/oauth2/token" rel="nofollow noreferrer">https://discord.com/api/oauth2/token</a></p>
  <p>Here is my code:</p>
  <pre class="lang-js prettyprint-override"><code>    async GetToken(code) {
          let access_token;
          const payload = {
              'client_id': client_id,
              'client_secret': client_secret,
              'grant_type': 'authorization_code',
              'code': code,
              'redirect_uri': redirect_uri,
              'scope': scope,
          };
          const config = {
              headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
          };
          fetch(discord_token_url, {
              method: 'post',
              body: payload,
              headers: config.headers,
          }).then(response =&gt; response.json()).then(json =&gt; console.log(json)).catch(err =&gt; console.log(err));
          return access_token;
      },
  </code></pre>
  <p>And here's the err I get:</p>
  <pre><code>{
    error: 'unsupported_grant_type',
    error_description: 'Grant type None is not supported'
  }
  </code></pre>
  <p>As you can see I've given the correct grant type yet I get this error.</p>