To use the Facebook API, like the Login with Facebook or Facebook Graph API, you need to create a Facebook App. When you make a Facebook App, that app will have an App ID and an App Secret. You need these credentials to do almost anything with Facebook, including going through the OAuth authorization flow and working with Facebook's Graph API.
With the App ID, you can send API requests to Facebook for data. The Facebook App Secret can be used to decode the encrypted data.
Please follow below steps to create Facebook application:
- Login to your Facebook account and navigate to http://developers.facebook.com
- if you were already registered for Facebook developer account, you can skip this step and go to step #3 of this post. If you are not registered on Facebook developer account, then you need to follow these steps:
Click on Get Started button from top right corner.
Click on next button from the popup
Enter your phone number and verify your account using text message or phone call.
On next screen, after verifying account, enter your app name and your email and click on Next button.This app name will be shown to end users when they will try to “Login with Facebook” and they are redirected to Facebook website for login permission. So, make sure you give meaningful name here which can identify your website.
Enter captcha code and click on submit button.
From welcome screen click on close(x) icon. It will open product list page
- If you are already registered with Facebook developer perform below steps:
Click on “My App” >> “Add a New App”
From the popup enter “Display Name” of your new application and“Contact Email”, then click on “Create App Id” Button.This app display name will be shown to end users when they will try to “Login with Facebook” and they are redirected to Facebook website for login permission. So, make sure you give meaningful name here which can identify your website.
Enter captcha code and click on submit button and It will open product list page.
- From the product list page click on “Set Up” button from product with name “Facebook Login”.
- In left side menu, click on the “Facebook Login” link to expand the sub menu. Click on “Settings” from the sub menu.
- Enter your website URL in “Valid OAuth redirect URIs”. For example, my website domain is yourdomain.com so I entered https://yourdomain.com
- Now click on “Dashboard” from left side menu.
- From the dashboard, click on “Show” button in “App Secret” text box. You can copy the “App Id” and “App Secret” which you can use for your Facebook API calls.
- By default when you create Facebook application, it is private and available only to you for testing purpose. End users can only use it after you make the app public. To do that go to Facebook application page, click on “App Review” from the left menu and activate your app.
- Click on the switch from “Make My first app public?” section and set it to “Yes”.
- Click on “Confirm” button in popup to make your app public.