title: Error 400: redirect_uri_mismatch when using gmail api (.net)
body: <p>Ok, so I'm trying to implement Gmail API on this project, everything I want to do is send an email, this is what I got so far:</p>
  
  <ol>
  <li>Register a new project at google developers console, enable the gmail API and configure the consent screen.</li>
  <li><p>In consent screen I just changed app name and scopes for gmail.send.</p></li>
  <li><p>Create my credentials as a webapp and this what I put on redirect uris. </p></li>
  </ol>
  
  <blockquote>
    <p><a href="http://localhost/Home/Index" rel="nofollow noreferrer">http://localhost/Home/Index</a></p>
  </blockquote>
  
  <p>As I'm working with MVC and wanted to use the template with Home controller and Index View, I don't know if this is correct but as far as I know, I must write the page where it should go after the authentication and that's the only page in my project.</p>
  
  <p>Then I download the <strong>credentials.json</strong> file and add it to my project, then execute this code, <strong><em>ruta</em></strong> is the path to my credentials.json</p>
  
  <pre><code>UserCredential credential;
          using (var stream =
              new FileStream(ruta, FileMode.Open, FileAccess.Read))
          {
              credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                  GoogleClientSecrets.Load(stream).Secrets,
                  Scopes,
                  "user",
                  CancellationToken.None).Result;
          }
  </code></pre>
  
  <p>After that I execute the program but I never see the auth page, instead of that, comes the error:</p>
  
  <blockquote>
    <p><strong>Error 400: redirect_uri_mismatch.</strong> The redirect URI in the request, <a href="http://127.0.0.1:62297/authorize/" rel="nofollow noreferrer">http://127.0.0.1:62297/authorize/</a>, does not match the ones authorized for the OAuth client. </p>
  </blockquote>
  
  <p>I've tried to add that URI as "<a href="http://localhost/authorize" rel="nofollow noreferrer">http://localhost/authorize</a>" and "<a href="http://localhost/authorize/" rel="nofollow noreferrer">http://localhost/authorize/</a>" to my redirect URIs but I keep getting the same error message.</p>
  
  <p>I'm pretty newbie with this, so I'm a bit lost about all this redirect uris, thanks for your answers</p>