Integrate Facebook Authentication in ASP.Net5 Web App

Have you recently created a web application using Visual Studio 2015RC? Looking to integrate Facebook authentication to this web application built on ASP.Net5? Then you have hit the right keys and reached the right place. Here, you will use easy steps to integrate Facebook authentication.

Now, that the app is ready, you will first need to navigate to developers.facebook.com. Here add the new web app, you have created. You will be asked to select a platform, from the given options. While undertaking this process, you should ideally choose website as the platform.

Name the App

Once, you have chosen the platform, your next step involves giving a name to the web app. The name should be relevant to your organization, or how the app works.

Create App Id

You have given the app a name. Now, move on and choose a category that best represents your app. You can select any category from the given choices; of course relevancy matters highly in here. Once you are done with selecting the category, your next step is to create an App ID which will represent the app. You should ideally create an app secret too to go with this app Id. This will help identify your app easily. Once, your app Id and app secret have been created, you need to create a project URL.

Configure Startup.cs

Now, you need to configure the startup.cs file. In here, you will need to configure IApplicationBuilder app, IHostingEnvironment env, Iloggerfactory method as well as uncommented. You can use the code given below for this task

app.UseFacebookAuthentication();

With this, the Facebook middleware is added using the HTTP Request Pipeline

Now, add AppId as well as AppSecret to the config.json file

  "Authentication": {

    "Facebook": {

      "AppId": "8xxxxxxxxxx",

      "AppSecret":  "2xxxxxxxxxxxxxxxxxxxxxx"

    }

  }

With this code added, when you run the application, and reach the login screen, you will find the Facebook button added to it.

When you click on this button, you will be redirected to the login page. Adding the login page for Facebook, enables users to login to the app by using their Facebook credentials.

Deepa is a passionate blogger associated with Semaphore Software. She loves sharing information regarding asp.net tips & tricks. If you are looking for hire asp.net developers India then just get in touch with her.

Deepa Ranganathan
  • asp.net5
  • integrate facebook
  • facebook authentication
  • web application
By Deepa Ranganathan On 19 Jun, 15  Viewed: 319

Other blogs you may like

How Bundling and Minification is Done in ASP.Net5?

When ASP.Net 4.5 was launched in the year 2012, you saw two new features- bundling and minification which helped reduce the file size. With these features, you could combined two or more CSS or JS files, and create a single file. The file size of this combined file is reduced with the help of... By Deepa Ranganathan   On 15 Jun 2015  Viewed: 297

Getting Started with ASP.Net 5 Cross Platform

The all new version of ASP.Net, ASP.Net5 has raised significant amount of curiosity as well as discussions, even before developers have started using it. It is an open source cross platform framework that is meant to develop cloud based web applications. This all new framework contains modular... By Deepa Ranganathan   On 04 Jun 2015  Viewed: 247

Uncovering key differences between IdentityHashMap and HashMap in Java

As a concurrent, object-oriented computer programming language, [Java web development][1] has been incredibly embraced by web programmers all over the world. With innovative features and functionalities getting added to Java on a regular basis, it won't be wrong to say that the software product is... By Celin Smith   On 26 Dec 2014  Viewed: 197

Do the Arguments in JavaScript Are Passed By Value Or Reference?

Since Java is a complicated language, beginners may find developing [Java Web Application Development][1] or web pages a difficult task. JavaScript (also referred to as JS) is much easier compared to Java, and helps to enhance how your web page works. Incorporating JS into your site's web page... By Celin Smith   On 23 Dec 2014  Viewed: 183