title: localhost redirect_uri does not work for Google Oauth2 (results in 400: invalid_request error)
body: <p>There was a recent update to the Google Cloud Platform oauth service enforcing strict usage of HTTPS for all redirect URIs. However, localhost urls should be exempt, and those are allowed to use http. More generally, the rules for validation are <a href="https://developers.google.com/identity/protocols/oauth2/web-server#uri-validation" rel="noreferrer">here</a>.</p>
  <p>I have since made updates for some of my company's internal Node web apps to comply with the new oauth changes, and they work perfectly when deployed.</p>
  <p><strong>My issue is with local development (on http://localhost:4000)</strong>. Whenever I try to sign in via Google on my localhost, I get a vague 400 invalid_request error saying my app does not comply with the security validation rules (already referenced). They also hyperlinked me to a <a href="https://developers.google.com/identity/protocols/oauth2/policies#secure-response-handling" rel="noreferrer">section in their docs about security and HTTPS</a>. I strongly believe that my redirect_uri meets their security standards (http://localhost:4000/login/google/callback
  ). I am also absolutely sure I have it correctly on the Google console credentials section (any mismatch would be a redirect_uri_mismatch error anyways). Please tell me if I'm missing something here? I use the 'passport-next/passport-google-oauth2' middleware package, and again, there are no problems when the app is deployed.</p>
  <p>I've also noticed recently a couple other people on here with similar unresolved issues:</p>
  <ol>
  <li><a href="https://stackoverflow.com/questions/69931586/google-oauth-from-localhost-throws-invalid-request-error">google oauth from localhost throws invalid request error (i don't fully understand the first answer/I don't understand how it's relevant)</a></li>
  <li><a href="https://stackoverflow.com/questions/69922059/error-400-invalid-request-when-using-google-oauth-2-0-in-local">error 400 invalid request when using google oauth 2-0 in local (no answers)</a></li>
  </ol>