In this article I will explain with an example, how to create FaceBook App and get FaceBook Application Id and Secret key.
 
 
Creating a new FaceBook Application
In order to create Facebook App follow the below steps.
1. First you need to visit Facebook Developers app using the following URL.
2. Then, Log in with your Facebook account. If you don't have a Facebook account, then click on Create new account.
Create FaceBook App and Facebook Application Id ( AppId ) and Secret Key
 
3. After Log in, click on Create App button.
Create FaceBook App and Facebook Application Id ( AppId ) and Secret Key
 
4. Now, select the Authenticate and request data from users with Facebook Login RadioButton and click on Next.
Create FaceBook App and Facebook Application Id ( AppId ) and Secret Key
 
5. Next, select the No,I’am not building a game option if you are not building a game as Login type and click on Next.
Create FaceBook App and Facebook Application Id ( AppId ) and Secret Key
 
6. Next, in the App details section fill the following details.
Add an app name – Name of your app.
App contact email – The Email address.
Business Account – It is optional. Here it is set as No Business Manager account selected from the DropDownList click on Create app.
Create FaceBook App and Facebook Application Id ( AppId ) and Secret Key
 
7. Finally, once the App is ready, you will now see the following screen where you can retrieve the App ID and Secret.
Create FaceBook App and Facebook Application Id ( AppId ) and Secret Key
 
 
Retrieving the Application Id and Secret
You will need to follow the steps to retrieve the App ID and Secret.
First, click on the created App i.e. MyApp.
Create FaceBook App and Facebook Application Id ( AppId ) and Secret Key
 
After clicking on the MyApp then, expand the App Settings and then click on Basic option from there.
Create FaceBook App and Facebook Application Id ( AppId ) and Secret Key
You can now see your App ID and App secret by clicking on the Show button. You can note down the App ID and App secret for further use.
Create FaceBook App and Facebook Application Id ( AppId ) and Secret Key
 
 
Configuring the Website with FaceBook Login
For configuring website with FaceBook Login, you need to click on Set up button in the FaceBook Login option in the Dashboard.
Create FaceBook App and Facebook Application Id ( AppId ) and Secret Key
 
Then, click on the Settings in the Facebook Login section.
Create FaceBook App and Facebook Application Id ( AppId ) and Secret Key
 
Now, fill the TextBox with URL in the Valid OAuth Redirect URIs section of your application page that will use FaceBook API.
Note: When you deploy your site to domain server, then make sure you update Website with FaceBook Login with the new URL otherwise the App won’t work.
 
Create FaceBook App and Facebook Application Id ( AppId ) and Secret Key
 
Finally, click on Save changes.
 
 
Possible Errors and their solutions
Error validating application. Invalid application ID.
Following error occurs, when you have set incorrect or invalid App ID.
Hence, you need to make sure you have specified correct App ID of a valid FaceBook App.
{
   "error": {
      "message": "Error validating application. Invalid application ID.",
      "type": "OAuthException",
      "code": 101
   }
}
 
Invalid redirect_uri: Given URL is not allowed by the Application configuration.
Following error occurs, when Valid OAuth Redirect URIs has URL that does not match with the URL of the page that’s making call to the FaceBook App.
Hence, you need to make sure that this field must always be set to the URL of the page that makes call to the FaceBook App.
{
   "error": {
      "message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration.",
      "type": "OAuthException",
      "code": 191
   }
}