ASP.NET Core 2.1 External login Fails in Production












0















I have a project at work were I need to use Google and Microsoft Account for login. So far it works as it should on local host, however SignInManager<IdentityUser>.ExternalLoginSignInAsync fails for both in the same way when deployed on the server. The user gets through the external login dialog as if it worked but fails in the callback.



The SignInResult offers no explanation other than "Failed". Note that this is first time I'm using ASP.Net Core, so I wouldn't be surprised if I missed something vital. The site doesn't use the autogenerated login pages.



public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}

public IConfiguration Configuration { get; }

public void ConfigureServices(IServiceCollection services)
{
services.Configure<IISOptions>(options =>
{
options.ForwardClientCertificate = false;
});

services.Configure<CookiePolicyOptions>(options =>
{
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});

services.AddAuthentication().AddGoogle(options =>
{
options.ClientId = Configuration["Authentication:Google:ClientId"];
options.ClientSecret = Configuration["Authentication:Google:ClientSecret"];
});

services.AddAuthentication().AddMicrosoftAccount(options =>
{
options.ClientId = Configuration["Authentication:Microsoft:ClientId"];
options.ClientSecret = Configuration["Authentication:Microsoft:ClientSecret"];
});

services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(SqlConfigurationDatabase.Credentials));

services.AddDefaultIdentity<IdentityUser>().AddEntityFrameworkStores<ApplicationDbContext>();

services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();

app.UseAuthentication();

app.UseMvc(routes =>
{
routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}");
routes.MapRoute(name: "add", template: "{controller=Product}/{action=Add}");
});
}
}


EDIT: I forgot to include the rest of login code. As for the markup:



<form asp-controller="Home" asp-action="ExternalLogin" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" target="_blank" class="form-horizontal">
@{
foreach (var provider in await SignInManager.GetExternalAuthenticationSchemesAsync())
{
var name = provider.DisplayName + ".png";
<button type="submit" name="provider" value="@provider.DisplayName" title="Log in using your @provider.DisplayName account">
<img src="~/images/@name" />
@provider.DisplayName
</button>
}
}
</form>


The Home controller is the only one that talks with the external login services.



public class HomeController : Controller
{
private readonly UserManager<IdentityUser> users;

private readonly SignInManager<IdentityUser> signIn;

public HomeController(UserManager<IdentityUser> userManager, SignInManager<IdentityUser> signInManager)
{
users = userManager;
signIn = signInManager;
}

public IActionResult Index()
{
if (signIn.IsSignedIn(User))
return RedirectToLocal("/Product/Abc123");

return View();
}

public IActionResult Gdpr()
{
return View();
}

[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public IActionResult ExternalLogin(string provider, string returnUrl = null)
{
var redirectUrl = Url.Action(nameof(ExternalLoginCallback), "Home", new { ReturnUrl = returnUrl });
var properties = signIn.ConfigureExternalAuthenticationProperties(provider, redirectUrl);

return Challenge(properties, provider);
}

[HttpGet]
[AllowAnonymous]
public async Task<IActionResult> ExternalLoginCallback(string returnUrl = null, string remoteError = null)
{
if (remoteError != null)
{
ModelState.AddModelError("", $"Error from external provider: {remoteError}");

return RedirectToAction(nameof(HomeController.Index), "Home");
}

var info = await signIn.GetExternalLoginInfoAsync();
if (info == null)
return RedirectToLocal(returnUrl);

var result = await signIn.ExternalLoginSignInAsync(info.LoginProvider, info.ProviderKey, isPersistent: false);
if (result.Succeeded)
return RedirectToLocal(returnUrl);
else
return RedirectToLocal(returnUrl);
}

private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
return Redirect(returnUrl);
else
return RedirectToAction(nameof(HomeController.Index), "Home");
}

[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Logout()
{
await signIn.SignOutAsync();

return RedirectToAction(nameof(HomeController.Index), "Home");
}

[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}


There is no load-balancing, clustering, web farms or any other fancy stuff going on at this time. I have basically just tweaked the example site created by Visual Studio (ASP.NET Core 2.1 Web Application with authentication set to Individual User Accounts).










share|improve this question

























  • Are you employing any load-balancing, clustering, web farms, etc.?

    – Chris Pratt
    Nov 26 '18 at 20:22













  • If you're not using the autogenerated pages for login, what are you using? It's really just guesswork at this stage without knowing what you're code is doing. For example, you'll get a Failed result if you're trying to sign in the user without an account existing within your Identity database itself.

    – Kirk Larkin
    Nov 26 '18 at 23:09











  • @KirkLarkin Interesting, but wouldn't that also be the case when debugging on localhost?

    – Uran
    Nov 27 '18 at 7:30











  • Well that depends on the database - it's plausible that you might've created an account previously that now lives in said database on localhost.

    – Kirk Larkin
    Nov 27 '18 at 8:01






  • 1





    @KirkLarkin Score, that is easy to do! Unfortunately management is getting impatient... seems I have to go with scaffolding Identity. So I can't test out your idea at the moment. But you seem to have hit the nail on the head with the identity. It explains a lot of seemingly random problems i've had the last week during testing. Thanks for the help!

    – Uran
    Nov 27 '18 at 9:59
















0















I have a project at work were I need to use Google and Microsoft Account for login. So far it works as it should on local host, however SignInManager<IdentityUser>.ExternalLoginSignInAsync fails for both in the same way when deployed on the server. The user gets through the external login dialog as if it worked but fails in the callback.



The SignInResult offers no explanation other than "Failed". Note that this is first time I'm using ASP.Net Core, so I wouldn't be surprised if I missed something vital. The site doesn't use the autogenerated login pages.



public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}

public IConfiguration Configuration { get; }

public void ConfigureServices(IServiceCollection services)
{
services.Configure<IISOptions>(options =>
{
options.ForwardClientCertificate = false;
});

services.Configure<CookiePolicyOptions>(options =>
{
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});

services.AddAuthentication().AddGoogle(options =>
{
options.ClientId = Configuration["Authentication:Google:ClientId"];
options.ClientSecret = Configuration["Authentication:Google:ClientSecret"];
});

services.AddAuthentication().AddMicrosoftAccount(options =>
{
options.ClientId = Configuration["Authentication:Microsoft:ClientId"];
options.ClientSecret = Configuration["Authentication:Microsoft:ClientSecret"];
});

services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(SqlConfigurationDatabase.Credentials));

services.AddDefaultIdentity<IdentityUser>().AddEntityFrameworkStores<ApplicationDbContext>();

services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();

app.UseAuthentication();

app.UseMvc(routes =>
{
routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}");
routes.MapRoute(name: "add", template: "{controller=Product}/{action=Add}");
});
}
}


EDIT: I forgot to include the rest of login code. As for the markup:



<form asp-controller="Home" asp-action="ExternalLogin" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" target="_blank" class="form-horizontal">
@{
foreach (var provider in await SignInManager.GetExternalAuthenticationSchemesAsync())
{
var name = provider.DisplayName + ".png";
<button type="submit" name="provider" value="@provider.DisplayName" title="Log in using your @provider.DisplayName account">
<img src="~/images/@name" />
@provider.DisplayName
</button>
}
}
</form>


The Home controller is the only one that talks with the external login services.



public class HomeController : Controller
{
private readonly UserManager<IdentityUser> users;

private readonly SignInManager<IdentityUser> signIn;

public HomeController(UserManager<IdentityUser> userManager, SignInManager<IdentityUser> signInManager)
{
users = userManager;
signIn = signInManager;
}

public IActionResult Index()
{
if (signIn.IsSignedIn(User))
return RedirectToLocal("/Product/Abc123");

return View();
}

public IActionResult Gdpr()
{
return View();
}

[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public IActionResult ExternalLogin(string provider, string returnUrl = null)
{
var redirectUrl = Url.Action(nameof(ExternalLoginCallback), "Home", new { ReturnUrl = returnUrl });
var properties = signIn.ConfigureExternalAuthenticationProperties(provider, redirectUrl);

return Challenge(properties, provider);
}

[HttpGet]
[AllowAnonymous]
public async Task<IActionResult> ExternalLoginCallback(string returnUrl = null, string remoteError = null)
{
if (remoteError != null)
{
ModelState.AddModelError("", $"Error from external provider: {remoteError}");

return RedirectToAction(nameof(HomeController.Index), "Home");
}

var info = await signIn.GetExternalLoginInfoAsync();
if (info == null)
return RedirectToLocal(returnUrl);

var result = await signIn.ExternalLoginSignInAsync(info.LoginProvider, info.ProviderKey, isPersistent: false);
if (result.Succeeded)
return RedirectToLocal(returnUrl);
else
return RedirectToLocal(returnUrl);
}

private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
return Redirect(returnUrl);
else
return RedirectToAction(nameof(HomeController.Index), "Home");
}

[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Logout()
{
await signIn.SignOutAsync();

return RedirectToAction(nameof(HomeController.Index), "Home");
}

[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}


There is no load-balancing, clustering, web farms or any other fancy stuff going on at this time. I have basically just tweaked the example site created by Visual Studio (ASP.NET Core 2.1 Web Application with authentication set to Individual User Accounts).










share|improve this question

























  • Are you employing any load-balancing, clustering, web farms, etc.?

    – Chris Pratt
    Nov 26 '18 at 20:22













  • If you're not using the autogenerated pages for login, what are you using? It's really just guesswork at this stage without knowing what you're code is doing. For example, you'll get a Failed result if you're trying to sign in the user without an account existing within your Identity database itself.

    – Kirk Larkin
    Nov 26 '18 at 23:09











  • @KirkLarkin Interesting, but wouldn't that also be the case when debugging on localhost?

    – Uran
    Nov 27 '18 at 7:30











  • Well that depends on the database - it's plausible that you might've created an account previously that now lives in said database on localhost.

    – Kirk Larkin
    Nov 27 '18 at 8:01






  • 1





    @KirkLarkin Score, that is easy to do! Unfortunately management is getting impatient... seems I have to go with scaffolding Identity. So I can't test out your idea at the moment. But you seem to have hit the nail on the head with the identity. It explains a lot of seemingly random problems i've had the last week during testing. Thanks for the help!

    – Uran
    Nov 27 '18 at 9:59














0












0








0


0






I have a project at work were I need to use Google and Microsoft Account for login. So far it works as it should on local host, however SignInManager<IdentityUser>.ExternalLoginSignInAsync fails for both in the same way when deployed on the server. The user gets through the external login dialog as if it worked but fails in the callback.



The SignInResult offers no explanation other than "Failed". Note that this is first time I'm using ASP.Net Core, so I wouldn't be surprised if I missed something vital. The site doesn't use the autogenerated login pages.



public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}

public IConfiguration Configuration { get; }

public void ConfigureServices(IServiceCollection services)
{
services.Configure<IISOptions>(options =>
{
options.ForwardClientCertificate = false;
});

services.Configure<CookiePolicyOptions>(options =>
{
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});

services.AddAuthentication().AddGoogle(options =>
{
options.ClientId = Configuration["Authentication:Google:ClientId"];
options.ClientSecret = Configuration["Authentication:Google:ClientSecret"];
});

services.AddAuthentication().AddMicrosoftAccount(options =>
{
options.ClientId = Configuration["Authentication:Microsoft:ClientId"];
options.ClientSecret = Configuration["Authentication:Microsoft:ClientSecret"];
});

services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(SqlConfigurationDatabase.Credentials));

services.AddDefaultIdentity<IdentityUser>().AddEntityFrameworkStores<ApplicationDbContext>();

services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();

app.UseAuthentication();

app.UseMvc(routes =>
{
routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}");
routes.MapRoute(name: "add", template: "{controller=Product}/{action=Add}");
});
}
}


EDIT: I forgot to include the rest of login code. As for the markup:



<form asp-controller="Home" asp-action="ExternalLogin" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" target="_blank" class="form-horizontal">
@{
foreach (var provider in await SignInManager.GetExternalAuthenticationSchemesAsync())
{
var name = provider.DisplayName + ".png";
<button type="submit" name="provider" value="@provider.DisplayName" title="Log in using your @provider.DisplayName account">
<img src="~/images/@name" />
@provider.DisplayName
</button>
}
}
</form>


The Home controller is the only one that talks with the external login services.



public class HomeController : Controller
{
private readonly UserManager<IdentityUser> users;

private readonly SignInManager<IdentityUser> signIn;

public HomeController(UserManager<IdentityUser> userManager, SignInManager<IdentityUser> signInManager)
{
users = userManager;
signIn = signInManager;
}

public IActionResult Index()
{
if (signIn.IsSignedIn(User))
return RedirectToLocal("/Product/Abc123");

return View();
}

public IActionResult Gdpr()
{
return View();
}

[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public IActionResult ExternalLogin(string provider, string returnUrl = null)
{
var redirectUrl = Url.Action(nameof(ExternalLoginCallback), "Home", new { ReturnUrl = returnUrl });
var properties = signIn.ConfigureExternalAuthenticationProperties(provider, redirectUrl);

return Challenge(properties, provider);
}

[HttpGet]
[AllowAnonymous]
public async Task<IActionResult> ExternalLoginCallback(string returnUrl = null, string remoteError = null)
{
if (remoteError != null)
{
ModelState.AddModelError("", $"Error from external provider: {remoteError}");

return RedirectToAction(nameof(HomeController.Index), "Home");
}

var info = await signIn.GetExternalLoginInfoAsync();
if (info == null)
return RedirectToLocal(returnUrl);

var result = await signIn.ExternalLoginSignInAsync(info.LoginProvider, info.ProviderKey, isPersistent: false);
if (result.Succeeded)
return RedirectToLocal(returnUrl);
else
return RedirectToLocal(returnUrl);
}

private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
return Redirect(returnUrl);
else
return RedirectToAction(nameof(HomeController.Index), "Home");
}

[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Logout()
{
await signIn.SignOutAsync();

return RedirectToAction(nameof(HomeController.Index), "Home");
}

[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}


There is no load-balancing, clustering, web farms or any other fancy stuff going on at this time. I have basically just tweaked the example site created by Visual Studio (ASP.NET Core 2.1 Web Application with authentication set to Individual User Accounts).










share|improve this question
















I have a project at work were I need to use Google and Microsoft Account for login. So far it works as it should on local host, however SignInManager<IdentityUser>.ExternalLoginSignInAsync fails for both in the same way when deployed on the server. The user gets through the external login dialog as if it worked but fails in the callback.



The SignInResult offers no explanation other than "Failed". Note that this is first time I'm using ASP.Net Core, so I wouldn't be surprised if I missed something vital. The site doesn't use the autogenerated login pages.



public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}

public IConfiguration Configuration { get; }

public void ConfigureServices(IServiceCollection services)
{
services.Configure<IISOptions>(options =>
{
options.ForwardClientCertificate = false;
});

services.Configure<CookiePolicyOptions>(options =>
{
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});

services.AddAuthentication().AddGoogle(options =>
{
options.ClientId = Configuration["Authentication:Google:ClientId"];
options.ClientSecret = Configuration["Authentication:Google:ClientSecret"];
});

services.AddAuthentication().AddMicrosoftAccount(options =>
{
options.ClientId = Configuration["Authentication:Microsoft:ClientId"];
options.ClientSecret = Configuration["Authentication:Microsoft:ClientSecret"];
});

services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(SqlConfigurationDatabase.Credentials));

services.AddDefaultIdentity<IdentityUser>().AddEntityFrameworkStores<ApplicationDbContext>();

services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();

app.UseAuthentication();

app.UseMvc(routes =>
{
routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}");
routes.MapRoute(name: "add", template: "{controller=Product}/{action=Add}");
});
}
}


EDIT: I forgot to include the rest of login code. As for the markup:



<form asp-controller="Home" asp-action="ExternalLogin" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" target="_blank" class="form-horizontal">
@{
foreach (var provider in await SignInManager.GetExternalAuthenticationSchemesAsync())
{
var name = provider.DisplayName + ".png";
<button type="submit" name="provider" value="@provider.DisplayName" title="Log in using your @provider.DisplayName account">
<img src="~/images/@name" />
@provider.DisplayName
</button>
}
}
</form>


The Home controller is the only one that talks with the external login services.



public class HomeController : Controller
{
private readonly UserManager<IdentityUser> users;

private readonly SignInManager<IdentityUser> signIn;

public HomeController(UserManager<IdentityUser> userManager, SignInManager<IdentityUser> signInManager)
{
users = userManager;
signIn = signInManager;
}

public IActionResult Index()
{
if (signIn.IsSignedIn(User))
return RedirectToLocal("/Product/Abc123");

return View();
}

public IActionResult Gdpr()
{
return View();
}

[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public IActionResult ExternalLogin(string provider, string returnUrl = null)
{
var redirectUrl = Url.Action(nameof(ExternalLoginCallback), "Home", new { ReturnUrl = returnUrl });
var properties = signIn.ConfigureExternalAuthenticationProperties(provider, redirectUrl);

return Challenge(properties, provider);
}

[HttpGet]
[AllowAnonymous]
public async Task<IActionResult> ExternalLoginCallback(string returnUrl = null, string remoteError = null)
{
if (remoteError != null)
{
ModelState.AddModelError("", $"Error from external provider: {remoteError}");

return RedirectToAction(nameof(HomeController.Index), "Home");
}

var info = await signIn.GetExternalLoginInfoAsync();
if (info == null)
return RedirectToLocal(returnUrl);

var result = await signIn.ExternalLoginSignInAsync(info.LoginProvider, info.ProviderKey, isPersistent: false);
if (result.Succeeded)
return RedirectToLocal(returnUrl);
else
return RedirectToLocal(returnUrl);
}

private IActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
return Redirect(returnUrl);
else
return RedirectToAction(nameof(HomeController.Index), "Home");
}

[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Logout()
{
await signIn.SignOutAsync();

return RedirectToAction(nameof(HomeController.Index), "Home");
}

[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}


There is no load-balancing, clustering, web farms or any other fancy stuff going on at this time. I have basically just tweaked the example site created by Visual Studio (ASP.NET Core 2.1 Web Application with authentication set to Individual User Accounts).







asp.net-core-2.1






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 27 '18 at 7:27







Uran

















asked Nov 26 '18 at 12:05









UranUran

81110




81110













  • Are you employing any load-balancing, clustering, web farms, etc.?

    – Chris Pratt
    Nov 26 '18 at 20:22













  • If you're not using the autogenerated pages for login, what are you using? It's really just guesswork at this stage without knowing what you're code is doing. For example, you'll get a Failed result if you're trying to sign in the user without an account existing within your Identity database itself.

    – Kirk Larkin
    Nov 26 '18 at 23:09











  • @KirkLarkin Interesting, but wouldn't that also be the case when debugging on localhost?

    – Uran
    Nov 27 '18 at 7:30











  • Well that depends on the database - it's plausible that you might've created an account previously that now lives in said database on localhost.

    – Kirk Larkin
    Nov 27 '18 at 8:01






  • 1





    @KirkLarkin Score, that is easy to do! Unfortunately management is getting impatient... seems I have to go with scaffolding Identity. So I can't test out your idea at the moment. But you seem to have hit the nail on the head with the identity. It explains a lot of seemingly random problems i've had the last week during testing. Thanks for the help!

    – Uran
    Nov 27 '18 at 9:59



















  • Are you employing any load-balancing, clustering, web farms, etc.?

    – Chris Pratt
    Nov 26 '18 at 20:22













  • If you're not using the autogenerated pages for login, what are you using? It's really just guesswork at this stage without knowing what you're code is doing. For example, you'll get a Failed result if you're trying to sign in the user without an account existing within your Identity database itself.

    – Kirk Larkin
    Nov 26 '18 at 23:09











  • @KirkLarkin Interesting, but wouldn't that also be the case when debugging on localhost?

    – Uran
    Nov 27 '18 at 7:30











  • Well that depends on the database - it's plausible that you might've created an account previously that now lives in said database on localhost.

    – Kirk Larkin
    Nov 27 '18 at 8:01






  • 1





    @KirkLarkin Score, that is easy to do! Unfortunately management is getting impatient... seems I have to go with scaffolding Identity. So I can't test out your idea at the moment. But you seem to have hit the nail on the head with the identity. It explains a lot of seemingly random problems i've had the last week during testing. Thanks for the help!

    – Uran
    Nov 27 '18 at 9:59

















Are you employing any load-balancing, clustering, web farms, etc.?

– Chris Pratt
Nov 26 '18 at 20:22







Are you employing any load-balancing, clustering, web farms, etc.?

– Chris Pratt
Nov 26 '18 at 20:22















If you're not using the autogenerated pages for login, what are you using? It's really just guesswork at this stage without knowing what you're code is doing. For example, you'll get a Failed result if you're trying to sign in the user without an account existing within your Identity database itself.

– Kirk Larkin
Nov 26 '18 at 23:09





If you're not using the autogenerated pages for login, what are you using? It's really just guesswork at this stage without knowing what you're code is doing. For example, you'll get a Failed result if you're trying to sign in the user without an account existing within your Identity database itself.

– Kirk Larkin
Nov 26 '18 at 23:09













@KirkLarkin Interesting, but wouldn't that also be the case when debugging on localhost?

– Uran
Nov 27 '18 at 7:30





@KirkLarkin Interesting, but wouldn't that also be the case when debugging on localhost?

– Uran
Nov 27 '18 at 7:30













Well that depends on the database - it's plausible that you might've created an account previously that now lives in said database on localhost.

– Kirk Larkin
Nov 27 '18 at 8:01





Well that depends on the database - it's plausible that you might've created an account previously that now lives in said database on localhost.

– Kirk Larkin
Nov 27 '18 at 8:01




1




1





@KirkLarkin Score, that is easy to do! Unfortunately management is getting impatient... seems I have to go with scaffolding Identity. So I can't test out your idea at the moment. But you seem to have hit the nail on the head with the identity. It explains a lot of seemingly random problems i've had the last week during testing. Thanks for the help!

– Uran
Nov 27 '18 at 9:59





@KirkLarkin Score, that is easy to do! Unfortunately management is getting impatient... seems I have to go with scaffolding Identity. So I can't test out your idea at the moment. But you seem to have hit the nail on the head with the identity. It explains a lot of seemingly random problems i've had the last week during testing. Thanks for the help!

– Uran
Nov 27 '18 at 9:59












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53480752%2fasp-net-core-2-1-external-login-fails-in-production%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53480752%2fasp-net-core-2-1-external-login-fails-in-production%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks