title: How to solve responseJSON: {error: "invalid_request", error_description: "Missing required parameter: code"}
body: <p>I'm trying to upload files to Google Drive from my web application with Vuejs and Javascript, but when I send the request it marks that error.
  I checked the value of variable <strong>code</strong> and is <strong>null</strong>, even the variable <strong>window.location.search</strong> is an empty string, but I don't know what value the code variable should have in the request.</p>
  <p>This is the section of code:</p>
  <pre><code>  const urlParams = new URLSearchParams(window.location.search);
    console.log (&quot;Value of window.location.search&quot;, window.location.search);
    const code = urlParams.get('code');
    console.log (&quot;Valor de code&quot;, code);
    const redirect_uri = &quot;http://localhost:3000/formacionProf&quot;
    const client_secret = clientSecret;
    const scope = &quot;https://www.googleapis.com/auth/drive&quot;;
    let access_token= &quot;&quot;;
    let client_id = clientID;
  
    $.ajax({
      type: 'POST',
      url: &quot;https://www.googleapis.com/oauth2/v4/token&quot;,
      data: {
        code: code,
        redirect_uri: redirect_uri,
        client_secret: client_secret,
        client_id: client_id,
        scope: scope,
        grant_type: &quot;authorization_code&quot;
      },
      dataType: &quot;json&quot;,
      success: function(resultData) {
        localStorage.setItem(&quot;accessToken&quot;,resultData.access_token);
        localStorage.setItem(&quot;refreshToken&quot;,resultData.refreshToken);
        localStorage.setItem(&quot;expires_in&quot;,resultData.expires_in);
        window.history.pushState({}, document.title, &quot;/formacionProf&quot;);
      },
      error: function (error) {
          console.log(error);
      }
    });
  </code></pre>
  <p>Thanks for your time.</p>