title: Google OAuth token request returns "invalid_client": "Unauthorized"
body: <p>Trying to get OAuth2 Google login working, this is the raw request that my app makes:</p>
  
  <p>Method: <code>POST</code></p>
  
  <p>URL: <code>https://www.googleapis.com/oauth2/v3/token</code></p>
  
  <p>Headers: <code>Content-Type: application/x-www-form-urlencoded</code></p>
  
  <p>Values:</p>
  
  <p><code>client_id</code>: <code>XXX-0123456789abcdef0123456789abcdef.apps.googleusercontent.com</code></p>
  
  <p><code>client_secret</code>: <code>A1b2C3d4E5f6G7h8I9j0K1l2M</code></p>
  
  <p><code>code</code>: <code>1/A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6Q7r8S9t0U1v</code></p>
  
  <p><code>grant_type</code>: <code>authorization_code</code></p>
  
  <p><code>redirect_uri</code>: <code>http://localhost:5000/callback/google/</code></p>
  
  <p>And this is the response:</p>
  
  <p>Status: <code>401 Unauthorized</code></p>
  
  <p>Body:</p>
  
  <pre><code>{
      "error": "invalid_client",
      "error_description": "Unauthorized"
  }
  </code></pre>
  
  <p>Have verified that this is the exact request / response that my app is making (a Python app using Flask and rauth), and have verified that I can reproduce the exact same request / response using Postman.</p>
  
  <p>Per instructions in other threads, I have done all of the following in the Google APIs console:</p>
  
  <ul>
  <li>In "OAuth consent screen" settings, set "Product name" to something different than "Project name"</li>
  <li>Also in "OAuth consent screen" settings, double-check that email is set</li>
  <li>Enable the Google+ API</li>
  <li>Enable the Gmail API</li>
  <li>Recreate the client ID / secret</li>
  <li>Double-check that there are no leading or trailing spaces in the client ID / secret values, I have copied them correctly from the API console</li>
  </ul>
  
  <p>No matter what I do, still getting the same response of <code>"invalid_client": "Unauthorized"</code>.</p>
  
  <p>Help with this would be appreciated. Am trying to set up OAuth2-powered "Log in with X" functionality in my app, have gotten Facebook and Twitter working without issues, would like to get Google working too, but if I can't resolve this then I'm afraid I'll have to ditch Google auth.</p>