title: Why is Google Oauth returning `invalid redirect_urI` in my Rails app?
body: <p>I'm adding Google Oauth2 to a Rails app, but have been unable to get past the early stages.</p>
  
  <p>I've set up an app, and defined client ID and secret.But I'm getting <code>Invalid parameter value for redirect_uri: Non-public domains not allowed: http://localhost/path/to/callback</code></p>
  
  <p>What does this mean? Is this because I'm testing on a local dev environment? </p>
  
  <p>Thanks for any ideas.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>This might be because the app's URI differs from the sending URI. But when I go to Google and try to authorize the path to my dev app, I get <code>OAuth2 redirect is invalid</code>. Is this a limitation of using a locally hosted app?</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>The request I'm generating looks like this:</p>
  
  <pre><code>https://accounts.google.com/o/oauth2/auth?response_type=code&amp;client_id=###########&amp;redirect_uri=http%3A%2F%2Fmyapp.dev%2Fusers%2Fauth%2Fgoogle_oauth2%2Fcallback&amp;scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&amp;approval_prompt=&amp;access_type=offline
  </code></pre>
  
  <p>Is this correct. I've tried this with client_id including and excluding the <code>.apps.googleusercontent.com</code> section. Neither seems to work.</p>