In ASP.NET 5, MVC 6, I was able to change the name of the external authentication cookie in the options - but that seems to be removed from the new providers in AspNetCore.Identity
RC2
libraries.
I've got this setup;
class Startup {
...
public void ConfigureServices(IServiceCollection services){
services.AddIdentity<Member, Role> ... // identity wired up
}
public void Configure(IApplicationBuilder app, ILoggerFactory logger) {
// .. other wiring
app
.UseIdentity()
.UseGoogleAuthentication
(new GoogleOptions {
ClientId = Constants.Google.Client,
ClientSecret = Constants.Google.Secret,
Scope = {"email", "profile"}
});
app.UseMvc(routes => {
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
}
There used to be an AuthenticationType
property that I could set to a string
and it would control the cookie name; But that's gone.
I read other posts that said to try SignInScheme
and AuthenticationScheme
- and I did, but that would start giving me an error that there was No Provider to Handle this Scheme
.
Is there anything I can do for it?
Here's how you can replace the default name used for the external cookie.
services.AddIdentity<Member, Role>(options =>
{
options.Cookies.ExternalCookie.CookieName = "name";
});
It's work for me in VS2017
In the Startup.cs ConfigureServices():
services.ConfigureApplicationCookie(options => {
options.Cookie.Name = "NewCookieName";
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With