title: ASP.NET Identity Cookie across subdomains
body: <p>For forms authentication I used this in web.config (note the domain attribute):</p>
  
  <pre><code>&lt;authentication mode="Forms"&gt;
    &lt;forms loginUrl="~/Account/Login" timeout="2880" name=".ASPXAUTH" protection="Validation" path="/" domain=".myserver.dev" /&gt;
  &lt;/authentication&gt;
  </code></pre>
  
  <p>How is a single sign-on across subdomains configured for the new ASP.NET Identity Framework in Mvc 5?</p>
  
  <p>More Info:</p>
  
  <p>I am creating a multitenant application.  Each client will be on a subdomain:</p>
  
  <p>client1.myapp.com</p>
  
  <p>client2.myapp.com</p>
  
  <p>I want a user to be able to sign on to <code>client1.myapp.com</code> and then go to <code>client2.myapp.com</code> and still be signed in.  This was easy with forms authentication.  I'm trying to figure out how to do it with the new Identity Framework.</p>
  
  <p>EDIT</p>
  
  <p>Here is the code that eventually worked for me:</p>
  
  <pre><code>app.UseCookieAuthentication(new CookieAuthenticationOptions
  {
    AuthenticationType = "Application",
    LoginPath = "/Account/Login",
    CookieDomain = ".myapp.com"
  });
  </code></pre>