Using Facebook Graph API With ASP.Net MVC

Introduction

In this article series we will learn how to implement custom social media integration into our ASP NET web application using the Facebook SDK.

Here we will see in practical terms how to access and update Facebook data utilizing the Graph API.

Before we proceed let's see the few terms.

  • OAuth 2.0: Open standard for authorization

Provides secure delegate access specifically from Facebook as an OAuth provider. It specifies a process for resource owners to authorize third-party access to their server resources without sharing their credentials.

  • OWIN: Open Web Interface for .NET

    Defines a standard interface between .NET web servers and web applications.
  • User Access Token: Encodes an App Id + User Id + Permissions
  • AppSecret_Proof: Encrypted Hash of the Access Token using App Secret key

So let's get started learning about Facebook Graph API integration.

Step 1: Open https://developers.facebook.com/ then click on My Apps and then add a new App as shown below.



Step 2: Select website and provide the Display name and namespace as shown below.

Here namespace is an alternative way to identify our application so don't confuse it with namespaces in C#.



Step 3: Click on settings and then click on Add Platform.



Step 4: Select website and we will get a couple of options as shown below.



Step 5: Now Let's create a test app which is best practice.




Summary

In this article we learn how to create a Facebook App. In the next article we will see how to authenticate with ASP.Net MVC applications.