AddIdentity() fails “InvalidOperationException: Scheme already exists: Identity.Application”

前端 未结 7 622
闹比i
闹比i 2021-01-07 22:05

I\'m trying to add facebook login to my .NET Core 2.1 site

I\'m following this , guide and more specific, this (for facebook login)

After have adding the lines

相关标签:
7条回答
  • 2021-01-07 22:42

    if removing the "addDefaultIdentity" from "Startup.cs" does not work for you .

    Replace services.AddDefaultIdentity<ApplicationUser> to AddIdentity<ApplicationUser, IdentityRole>

    Code snippet

      /*
                services.AddIdentity<ApplicationUser, IdentityRole>(options => options.SignIn.RequireConfirmedAccount = true)
                    .AddEntityFrameworkStores<ApplicationDbContext>();
                */
                
                services.AddDefaultIdentity<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true)
                    .AddEntityFrameworkStores<ApplicationDbContext>();
    
    0 讨论(0)
提交回复
热议问题