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,
Login with your
FaceBook account. If you don't have a
FaceBook account, then click on
Create new account.
3. After Login, click on Create App button.
4. Now, select the
Authenticate and request data from users with FaceBook Login RadioButton and click on
Next.
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.
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.
7. Finally, once the App is ready, you will now see the following screen where you can retrieve the App ID and Secret.
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.
After clicking on the MyApp then, expand the App Settings and then click on Basic option from there.
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.
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.
Then, click on the
Settings in the
FaceBook Login section.
Now, fill the
TextBox with URL in the
Valid OAuth Redirect URls 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..
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
}