Aspnetcore: Facebook login in Asp.Net Core 3.0 doesn't work

Created on 15 Mar 2019  路  1Comment  路  Source: dotnet/aspnetcore

Describe the bug

I've followed the steps in the docs to add facebook login to my web app, but I get an error stating that 'AuthenticationBuilder' doesn't contain a definition for 'AddFacebook'.

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of ASP.NET Core 3.0
  2. Run this code:
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure<CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });

            services.AddDbContext<ApplicationDbContext>(options =>
                options.UseSqlServer(
                    Configuration.GetConnectionString("DefaultConnection")));
            services.AddDefaultIdentity<ApplicationUser>()
                .AddDefaultUI(UIFramework.Bootstrap4)
                .AddEntityFrameworkStores<ApplicationDbContext>();

            services.AddAuthentication().AddFacebook(facebookOptions =>
            {
                facebookOptions.AppId = Configuration["Authentication:Facebook:AppId"];
                facebookOptions.AppSecret = Configuration["Authentication:Facebook:AppSecret"];
            });

            services.AddMvc()
                .AddNewtonsoftJson();
        }
  1. See error
area-security

Most helpful comment

You'll need to install the following NuGet Package
https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.Facebook/3.0.0-preview-19075-0444

(This version is for .NET Core Preview 3; If you receive an exception, particularly MissingMethodException you probably have a version mis-match)

>All comments

You'll need to install the following NuGet Package
https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.Facebook/3.0.0-preview-19075-0444

(This version is for .NET Core Preview 3; If you receive an exception, particularly MissingMethodException you probably have a version mis-match)

Was this page helpful?
0 / 5 - 0 ratings