When creating an ASP.NET Core web application using the web app template in VS 2017 preview, a web application with ASP.NET Core 1.1 is scaffolded. Adding external authentication providers following this or this instruction works like a charm. But then, after migrating to ASP.NET Core 2.0, the redirect URL getting the user from the external auth provider back to the web app (i.e. /signin-microsoft, /signin-google, /signin-facebook etc.) stopped working and resulted in a 404.
In ASP.NET Core 1.1, we had to add Identity with the following statement:
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { app.UseIdentity(); }
Which has changed in ASP.NET Core 2.0 to:
public void ConfigureServices(IServiceCollection services) { services.AddIdentity<ApplicationUser, IdentityRole>(); }
Well, it turns out (and is stated in the documents), you now have to explicitly call “UseAuthentication”:
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { app.UseAuthentication(); }
And voila, the redirect URLs work again.
I guess i ended up deleting this line by accident 🙁
Thank you very much.
Me too. Thank you.