ASP.NET Core Authentication and Authorization – Part 2

Hi Friends,

In this section, I will continue from the last section and delve further into authentication. Now, let’s bring some OAuth capabilities into the application. So, the first change, I need to make here is to include the required packages in project.json file. Here, I will show another technique to add the required packages. We already know this technique and this is via Nuget Package Manager as shown below in the screen shot.


Similarly, I installed many other account packages like shown below.


Similar thing I can verify in my project.json file.


Now, before setting the MiddleWare, I also need the App-ID and Secret Key. For doing so, let us go to

Here, I need to click on Add New App as shown below in the screenshot.


Then, we will select website from the below options.


Then, I will just provide the mandatory details and fill the required things up like shown below


Then, I will just give the URL detail as shown below.


Then, I will click on next on go on developer’s dashboard page like shown below. Here, I have omitted APP-ID and Secret Key for obvious reasons. Now, these keys, I will make use in my application.

243rd 244th

So, FB setup is done. Now, its time to setup the Middleware, which we have installed. As a best practice, we should be using secret manager to store the key so that it won’t get checked in with the source control. But, for demo its ok to have here.


With this change in place, when I go to my app, it will present me Facebook link over there.


And, when I click on facebook button, it will take me to Facebook authentication page.


Here, I will provide my credentials and login, it will present me below page.


Then, I will provide some email id which I want to identify as FB authenticated person like shown below.


And, if I click on the my profile, it will present all the external logins associated with the app as shown below.


I hope you would have liked this discussion. In the coming section, we will delve further. Thanks for joining me.

Rahul Sahay
Happy Coding

Thanks, Rahul Happy Coding