title: google-api-nodejs-client throws invalid_request error when exchanging code with tokens
body: <p>I've got a simple client app using react-google-login with this settings:</p>
  
  <pre><code>&lt;GoogleLogin
          clientId={config.CLIENT_ID}
          scope={config.SCOPES.join(' ')}
          buttonText="Login With Google"
          onSuccess={response =&gt; onSignIn('google', response)}
          onFailure={this.failure.bind(this)}
          accessType="offline"
          responseType="code"
        /&gt;
  </code></pre>
  
  <p>It retrieves the code successfully and sends it to the backend server which is written with NodeJS.</p>
  
  <p>The server-side code looks like this:</p>
  
  <pre><code>const { google } = require('googleapis');
  const config = global.config;
  const oauth2Client = new google.auth.OAuth2({
    clientId: config.google.CLIENT_ID,
    clientSecret: config.google.CLIENT_SECRET,
  });
  
  // code omitted for the sake of simplicity
  
  var authCode = req.body.authCode; // the provided code by google
  
  const { tokens } = await oauth2Client.getToken(authCode);
  return tokens;
  </code></pre>
  
  <p>When I run the code, it throws the error:</p>
  
  <pre><code>{ error: 'invalid_request',
          error_description: 'Missing parameter: redirect_uri' } },
    code: '400' }
  </code></pre>
  
  <p>and if I add redirectUrl to Developer Console, client app and server-side app, I'll get <code>redirect_uri_mismatch</code> error.</p>
  
  <p>I'm kind of stuck here and couldn't find anything useful on the web.</p>
  
  <p>Any workaround would be appreciated.</p>