title: ASP.NET Core: InvalidOperationException: No authenticationScheme was specified, and there was no DefaultSignInScheme found
body: <p>We have a brand new ASP.NET Core site, for the purpose of upgrading an old ASP.NET Framework site.  We used DotNetOpenAuth for OpenID logins back then, and now we're trying to replicate in ASP.NET Core.</p>
  
  <p>We have gotten as far as our site redirecting to the OpenID provider, being able to log in, but it throws an exception upon calling back to our site:</p>
  
  <p><code>InvalidOperationException: No authenticationScheme was specified, and there was no DefaultSignInScheme found.</code></p>
  
  <p>I am unable to find a complete example, which would really help me understand the whole process.  I have pulled together the following from a variety of sources...</p>
  
  <p>In Startup's ConfigureServices:</p>
  
  <pre><code>            services.AddDistributedMemoryCache();
  
              services.AddSession(options =&gt;
              {
                  // Set a short timeout for easy testing.
                  options.IdleTimeout = TimeSpan.FromSeconds(10);
                  options.Cookie.HttpOnly = true;
                  options.Cookie.SecurePolicy = CookieSecurePolicy.Always; //require https
                  // Make the session cookie essential
                  options.Cookie.IsEssential = true;
              });
  
              services.Configure&lt;CookiePolicyOptions&gt;(options =&gt;
              {
                  // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                  options.CheckConsentNeeded = context =&gt; false; //true;
                  options.MinimumSameSitePolicy = SameSiteMode.None;
              });
  
              services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
  
              services.AddSimpleInjector(_simpleInjectorContainer, options =&gt;
              {
                  // AddAspNetCore() wraps web requests in a Simple Injector scope.
                  options.AddAspNetCore()
                      // Ensure activation of a specific framework type to be created by
                      // Simple Injector instead of the built-in configuration system.
                      .AddControllerActivation()
                      .AddViewComponentActivation();
                  //.AddPageModelActivation()
                  //.AddTagHelperActivation();
              });
  
              services.AddAuthentication(options =&gt;
              { /* Authentication options */
                //options.DefaultAuthenticateScheme = "Steam";
  
              })
                  .AddSteam(options =&gt;
                  {
                  });
  </code></pre>
  
  <p>With no prior experience in ASP.NET Core, I have blindly tried assigning "Steam" to <code>DefaultAuthenticateScheme</code> inside of <code>AddAuthentication</code>, but that throws an error saying it cannot call itself.</p>
  
  <p>We've been using the default Home controller as a testing ground:</p>
  
  <pre><code>    [HttpGet("~/signin")]
      public IActionResult SignIn()
      {
          // Instruct the OIDC client middleware to redirect the user agent to the identity provider.
          // Note: the authenticationType parameter must match the value configured in Startup.cs
          return Challenge(new AuthenticationProperties
          {
              RedirectUri = Url.Action("HandleSteamLogin", "Home"),
          }, "Steam");
      }
  
      public async Task&lt;IActionResult&gt; HandleSteamLogin()
      {
          //Everything in this method is marked as obsolete, so it's a poor example.  I guess it's from an older version of ASP.NET Core?
  
          var claimsPrincipal = await HttpContext.Authentication.AuthenticateAsync("ExternalCookie");
  
          //do something the the claimsPrincipal, possibly create a new one with additional information
          //create a local user, etc
  
          await HttpContext.Authentication.SignInAsync("MainCookie", claimsPrincipal);
          await HttpContext.Authentication.SignOutAsync("ExternalCookie");
          return Redirect("~/");
      }
  </code></pre>
  
  <p>I can even see in the exception data, we are getting the necessary login information back, but I really need a complete example for me to be able to understand.</p>