title: OpenIdConnect Correlation Cookie not found when user click link from Office application
body: <p>I have an app that is authenticating with Azure Active Directory using OpenIdConnect. Everything is working fine except when I link to my site from a Office Application (excel/ word). From these applications I get a "Exception: Correlation failed.".</p>
  
  <p>From my research it seems to be that office is first doing the 302 redirect and then opening that page not the original link.</p>
  
  <p>See: <a href="https://github.com/aspnet/Security/issues/1252" rel="nofollow noreferrer">https://github.com/aspnet/Security/issues/1252</a></p>
  
  <p>After a recommendation for how to handle this scenario. I don't want to have to make to many changes to the authentication flow and introduce bugs.</p>
  
  <p>I have tried redirecting to a different page on my site when a user-agent of excel is detected. I thought then the correct cookie would be set and I could redirect from there to the requested page which would then trigger authorization. No luck though</p>
  
  <pre><code>OnRedirectToIdentityProvider = context =&gt;
  {                   
       if (context.Request.Headers["User-Agent"].ToString().Contains("Microsoft Office Excel"))
       {
  
                string redirect = context.Request.Scheme + "://" + context.Request.Host + context.Request.PathBase + "/Home/Office" + "?url=" + context.Request.Scheme + "://" + context.Request.Host + context.Request.PathBase + context.Request.Path;
                context.Response.Clear();
                context.Response.Redirect(redirect);
                context.HandleResponse();
                return Task.CompletedTask;
      }
  }
  </code></pre>