title: Why is [Owin] throwing a null exception on new project?
body: <p>I have a rather strange issue i'm not sure how to fix or if i can even fix it.</p>
  
  <p>I've done some research into the issue but can't find an answer to what's causing it.</p>
  
  <p>I'm following a rather simple guide at <a href="http://www.asp.net/mvc/tutorials/mvc-5/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-on">http://www.asp.net/mvc/tutorials/mvc-5/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-on</a></p>
  
  <p>and after enabling <strong><code>SSL</code></strong> and changing the <strong><code>controller</code></strong> to require https i get the following error:</p>
  
  <blockquote>
    <p>Server Error in '/' Application.</p>
    
    <p>Object reference not set to an instance of an object.</p>
    
    <p>Description: An unhandled exception occurred during the execution of
    the current web request. Please review the stack trace for more
    information about the error and where it originated in the code. </p>
    
    <p>Exception Details: System.NullReferenceException: Object reference not
    set to an instance of an object.</p>
    
    <p>Source Error: </p>
    
    <p>An unhandled exception was generated during the execution of the
    current web request. Information regarding the origin and location of
    the exception can be identified using the exception stack trace below.</p>
    
    <p>Stack Trace: </p>
    
    <p>[NullReferenceException: Object reference not set to an instance of an
    object.]<br>
    Microsoft.Owin.Security.Cookies.CookieAuthenticationProvider.Exception(CookieExceptionContext
    context) +49<br>
    Microsoft.Owin.Security.Cookies.d__2.MoveNext()
    +3698    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
    task) +93<br>
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
    task) +52    System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
    +24    Microsoft.Owin.Security.Infrastructure.d__0.MoveNext()
    +810    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
    task) +93<br>
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
    task) +52    System.Runtime.CompilerServices.TaskAwaiter.GetResult()
    +21    Microsoft.Owin.Security.Infrastructure.d__0.MoveNext() +427    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
    task) +93<br>
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
    task) +52    System.Runtime.CompilerServices.TaskAwaiter.GetResult()
    +21    Microsoft.AspNet.Identity.Owin.d__0.MoveNext() +641    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
    task) +93<br>
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
    task) +52    System.Runtime.CompilerServices.TaskAwaiter.GetResult()
    +21    Microsoft.AspNet.Identity.Owin.d__0.MoveNext() +641    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
    task) +93<br>
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
    task) +52    System.Runtime.CompilerServices.TaskAwaiter.GetResult()
    +21    Microsoft.AspNet.Identity.Owin.d__0.MoveNext() +641    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
    task) +93<br>
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
    task) +52    System.Runtime.CompilerServices.TaskAwaiter.GetResult()
    +21    Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.d__5.MoveNext()
    +287    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
    task) +93<br>
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
    task) +52    System.Runtime.CompilerServices.TaskAwaiter.GetResult()
    +21    Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.d__2.MoveNext()
    +272    System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +22    Microsoft.Owin.Host.SystemWeb.Infrastructure.ErrorState.Rethrow() +33 
    Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult
    ar) +150<br>
    Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult
    ar) +42<br>
    System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    +415    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155</p>
    
    <p>Version Information: Microsoft .NET Framework Version:4.0.30319;
    ASP.NET Version:4.0.30319.34237</p>
  </blockquote>
  
  <p>Turning off <code>SSL</code> fixes the issue, I also know that commenting out the <strong><code>startup.auth</code></strong> in <code>app_start</code> fixes the issue on <code>SSL</code>.</p>
  
  <p><strong>Does anyone know why this is happening?</strong></p>