title: Override redirect URL in AddMicrosoftAccount() identity OAuth for ASP.NET Core web app
body: <p>I have a website deployed to Azure. I've used Cloudflare in order to CNAME the azurewebsites domain, and therefore set the redirect URL to the Cloudflare hosted domain name as:</p>
  
  <p><a href="https://www.example.com/signin-microsoft" rel="nofollow noreferrer">https://www.example.com/signin-microsoft</a></p>
  
  <p>When I try and login, I get a failure, and the link provided by Microsoft is:</p>
  
  <pre><code>https://login.live.com/err.srf?lc=1033#error=invalid_request&amp;error_description=The+provided+value+for+the+input+parameter+'redirect_uri'+is+not+valid.+The+expected+value+is+'https://login.live.com/oauth20_desktop.srf'+or+a+URL+which+matches+the+redirect+URI+registered+for+this+client+application.&amp;state=xxx
  </code></pre>
  
  <p>When I run Fiddler, I can see that the redirect URL passed through by my app, is not the <a href="https://www.example.com" rel="nofollow noreferrer">https://www.example.com</a>, but the following:</p>
  
  <pre><code>/common/oauth2/v2.0/authorize?client_id=f0caa31c-3117-4479-a284-65f5a38ff5b6&amp;scope=https%3A%2F%2Fgraph.microsoft.com%2Fuser.read&amp;response_type=code&amp;redirect_uri=https%3A%2F%2Fexample.azurewebsites.net%2Fsignin-microsoft
  </code></pre>
  
  <p>When I setup the Microsoft OAuth in my app, I have these settings, but I can't find one to override the redirect-url:</p>
  
  <pre><code>services.AddAuthentication().AddMicrosoftAccount(microsoftOptions =&gt;
  {
      microsoftOptions.ClientId = Configuration["Authentication:Microsoft:ApplicationId"];
      microsoftOptions.ClientSecret = Configuration["Authentication:Microsoft:Password"];
  });
  </code></pre>
  
  <p>Does anyone have any suggestions? To complicate the matters, I've got this structure:</p>
  
  <ul>
  <li>Cloudflare</li>
  <li>Azure CDN</li>
  <li>Azure Web app</li>
  </ul>