public async Task <ActionResult> ExternalLoginCallback(string returnUrl) { AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie); var externalIdentity = await AuthenticationManager.GetExternalIdentityAsync(DefaultAuthenticationTypes.ExternalCookie); if (externalIdentity == null) { throw new Exception("Could not get the external identity. Please check your Auth0 configuration settings and ensure that " + "you configured UseCookieAuthentication and UseExternalSignInCookie in the OWIN Startup class. " + "Also make sure you are not calling setting the callbackOnLocationHash option on the JavaScript login widget."); } AuthenticationManager.SignIn(new AuthenticationProperties { IsPersistent = false }, CreateIdentity(externalIdentity)); await BoxHelper.PrepareBoxAppUser(externalIdentity); return(RedirectToLocal(returnUrl)); }