Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure Facebook Authentication Code Section #11028

Closed
alexmackey opened this Issue Feb 20, 2019 — with docs.microsoft.com · 4 comments

Comments

Projects
None yet
3 participants
Copy link

alexmackey commented Feb 20, 2019 — with docs.microsoft.com

The code snippet in Configure Facebook Authentication Code, ConfigureServices could be made clearer by either including the setup of dbcontext (e.g. below) or mention this snippet should be placed after the call to AddDbContext to avoid a confusing dependency resolution error.

services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(
Configuration.GetConnectionString("DefaultConnection")));


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@Rick-Anderson

This comment has been minimized.

Copy link
Contributor

Rick-Anderson commented Feb 20, 2019

@alexmackey The setup of ApplicationDbContext doesn't have anything directly to do with this tutorial. That should all be done in the previous tutorial, which is a prerequisite.

this snippet should be placed after the call to AddDbContext to avoid a confusing dependency resolution error.

It does show that.

services.AddDefaultIdentity<IdentityUser>()
        .AddDefaultUI(UIFramework.Bootstrap4)
        .AddEntityFrameworkStores<ApplicationDbContext>();

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

This comment has been minimized.

Copy link
Author

alexmackey commented Feb 20, 2019

Hey Rick I understand and maybe its just me but when I followed tutorial through I interpreted this as this code snippet replaced the existing code in configure services method which then led to the dependency resolution error (and 20 mins whilst I worked out what caused it).

E.g. if this read "Add the Facebook service in the ConfigureServices method in the Startup.cs file below the existing call to AddDbContext" this would be clearer?

@Rick-Anderson

This comment has been minimized.

Copy link
Contributor

Rick-Anderson commented Feb 21, 2019

In the next sweep I'll add the entire ConfigureServices and highlight the code to add.

@alexmackey

This comment has been minimized.

Copy link
Author

alexmackey commented Feb 21, 2019

awesome! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.