title: Connecting to Google via OAuth 2 "Invalid parameter value for redirect_uri: Missing authority: "
body: <p>I am trying to connect to Google via OAuth2. I am using code which works in another application, so I am quite sure the problem is in the configuration at Google.</p>
  
  <p>I registered a client-id and secret-key in the Google Console which I added to the authorization config:</p>
  
  <pre><code>var client = new GoogleOAuth2Client("[client id].apps.googleusercontent.com", "[secret key]");
  var extraData = new Dictionary&lt;string, object&gt;();
  OAuthWebSecurity.RegisterClient(client, "Google", extraData);
  </code></pre>
  
  <p>Unfortunately, when I press the button to connect I get the following error:</p>
  
  <blockquote>
    <ol start="400">
    <li>That’s an error.<br><br>
    <strong>Error: invalid_request</strong><br>
    <br>Invalid parameter value for redirect_uri: Missing authority:<br>  file:///Account/ExternalLoginCallback%3FReturnUrl=/<br><br>Request Details<br>    scope=<a href="https://www.googleapis.com/auth/userinfo.profile" rel="noreferrer">https://www.googleapis.com/auth/userinfo.profile</a> <br><a href="https://www.googleapis.com/auth/userinfo.email" rel="noreferrer">https://www.googleapis.com/auth/userinfo.email</a>
    <br>response_type=code
    <br>redirect_uri=file:///Account/ExternalLoginCallback%3FReturnUrl=/
    <br>state=<strong>provider</strong>=google&amp;<strong>sid</strong>=[numbers]
    client_id=[client id].apps.googleuserconte</li>
    </ol>
  </blockquote>
  
  <p>I've tried changing the localhost parameter in <code>/etc/hosts</code> file to other base URLs and I've  added these locations to redirect URIs in Google Console as follows:</p>
  
  <pre><code>http://localhost:8080/Account/ExternalLoginCallback%3FReturnUrl=/ 
  http://localhost.example.com:8080/Account/ExternalLoginCallback
  http://localhost.example.com:8080/Account/ExternalLoginCallback%3FReturnUrl=/
  </code></pre>
  
  <p>The error persists. I don't know what the problem can be and I hope someone can give me some guidance. Thanks</p>