title: Two authentication cookies in ASP.NET Core Identity
body: <p>Let's suppose we have a web-site where there are:</p>
  
  <ul>
  <li>Admin section</li>
  <li>Client section</li>
  <li>Guest(visitor) section</li>
  </ul>
  
  <p>Obviously, the last one (Guest section) can be accessed by everyone while admin part - only by administrations and client part - only by registered clients.
  Admins and clients have different model classes (Admin and User correspondingly), are stored in the different databases and we would like to use different authentication cookies for each of them. 
  Is it possible to do with ASP.NET Core Identity?</p>
  
  <p>We tried to use CookieName property during AddIdentity initialization but it appears that ApplicationCookie accessible there - is the same object, so the second definition simply rewrites the first one:</p>
  
  <pre><code>services
      .AddIdentity&lt;User, UserRole&gt;(opts =&gt; {
          opts.Cookies.ApplicationCookie.CookieName = "Client";
          opts.Cookies.ApplicationCookie.LoginPath = new PathString("/login");
            .    .    .    .    .   .   
  
      });
  
  
  
  services
      .AddIdentity&lt;Admin, AdminRole&gt;(opts =&gt; {
          //the following lines rewrite cookie options from client's to admin's
          opts.Cookies.ApplicationCookie.CookieName = "Admin";
          opts.Cookies.ApplicationCookie.LoginPath = new PathString("/admin/login");
            .    .    .    .    .   .   
      });
  </code></pre>