title: No authenticationScheme was specified, and there was no DefaultChallengeScheme found Cookies Authentication
body: <p>I am using the below code for authentication in ASP.NET Core 2.0 using cookies</p>
  
  <pre><code>services
      .AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
      .AddCookie("MyCookieMiddlewareInstance", options =&gt;
      {
          options.AccessDeniedPath = new PathString("/Account/Login");
          options.LoginPath = new PathString("/Account/Login");
          options.LogoutPath = new PathString("/Account/LogOff");
      });
  </code></pre>
  
  <p>I am getting an error:</p>
  
  <blockquote>
    <p>No authenticationScheme was specified, and there was no DefaultChallengeScheme found</p>
  </blockquote>
  
  <p>The cookies setup is below:</p>
  
  <pre><code>var claims = new List&lt;Claim&gt;
  {
      new Claim(ClaimTypes.NameIdentifier, userId.ToString()),
      new Claim(ClaimTypes.Name, userName)
  };
  
  var identity = new ClaimsIdentity(claims, "Forms");
  identity.AddClaim(new Claim(ClaimTypes.Role, "ADMIN"));
  var principal = new ClaimsPrincipal(identity);
  HttpContext.Authentication.SignInAsync("MyCookieMiddlewareInstance", principal, new AuthenticationProperties
  {
      IsPersistent = isPersistent,
      ExpiresUtc = DateTime.UtcNow.AddYears(1)
  });
  </code></pre>
  
  <p>I did  some research and didn't find the solution. Here is <a href="https://docs.microsoft.com/en-us/aspnet/core/security/authentication/cookie?tabs=aspnetcore2x" rel="noreferrer">a link to the doc</a> I used: </p>
  
  <p>Can anyone please let me know how can I resolve this issue?</p>