How to Create Facebook App, App ID, and App Secret

Facebook app is used in many cases, the most used case is Facebook login integration on the website. In this tutorial, we’ll provide the step-by-step guide to creating a new Facebook application. To implement login with Facebook on the website, you need to register an app in Facebook developers panel. You’ll get App ID and App Secret from the Facebook app, these details are required for authenticating your web application with Facebook.

Facebook Apps Creation

Follow the below steps to create a Facebook App and generate App ID & App Secret.

  • Go to the Facebook for Developers page and login with your Facebook account.
  • At the right corner of the top navigation bar, click the My Apps link and select Add New App.
    • Enter the Display Name and Contact Email.
    • Click the Create App ID button.
    • The new App will be created and redirected to the Facebook App Dashboard.
  • Navigate to the Settings » Basic page.
    • In App Domains field, specify the domain name of your website (ex: codexworld.com).
    • In Privacy Policy URL field, specify the privacy policy web page URL for login dialog (ex: https://www.codexworld.com/privacy-policy/)
    • Select the Category of your App.
    • Click the Save Changes button.
  • At the left navigation menu panel, click the PRODUCTS(+) link and navigate to the Add a Product page.
    • Select Facebook Login product and click the Set Up.
    • Select Web as the App platform.
    • Enter the Site URL (ex: https://www.codexworld.com).
    • Click the Save button.
  • Navigate to the Facebook Login » Settings page.
    • Go to the Client OAuth Settings section. In the Valid OAuth Redirect URIs field, specify the Redirect URL of your OAuth application (ex: https://www.codexworld.com/facebook-login-php/).
    • Click the Save Changes.
  • Change App Status:
    • By default, the App will be In Development mode. To change the App status in Live, click the toggle switch at the top header.
      facebook-app-creation-status-change-live-public-codexworld
    • On click the Status On/OFF switch, a confirmation dialog will appear. Confirm to make your app public.

Navigate to the Settings » Basic page, copy the App ID and App Secret. This App ID and App secret are required to access the Facebook APIs.

facebook-app-create-id-secret-api-settings-codexworld

Note that: You need to specify the App ID and App secret in the script when calling the Facebook API. Also, the URL specified in Valid OAuth Redirect URIs must be matched with the Redirect URL specified in the script.

Permissions to Get User Profile Data

The default and email permissions are approved by default and do not require App Review.

default:
The default permission grants your app to access the default fields of a user’s public profile.

  • id
  • first_name
  • last_name
  • middle_name
  • name
  • name_format
  • picture
  • short_name

email:
The email permission grants your app to access a user’s primary email address.

  • email

Go to the App Review » My Permissions and Features page to know about the Approved Permissions of your Facebook App.

facebook-app-review-permissions-public-profile-email-codexworld

Get the Profile Link and Gender

To retrieve the user’s Facebook Profile URL and gender, the user_link and user_gender permissions need to be Approved.

  • user_link: This permission grant your app to access the Facebook Profile URL of a user.
  • user_gender: This permission grant your app to access a user’s gender.

Follow the below steps to get user_link and user_gender permissions.

  • Go to the App Review » Permissions and Features page.
  • Click the Request link to submit a request for the respective permissions. Also, you need to provide the required information for submitting the approval request.
    facebook-app-permissions-user_link-user_gender-codexworld

Once the App Review process is completed and approved by the Facebook, you will be able to get the Facebook profile link and gender of the user.

Conclusion

You only need the App ID and App Secret to integrate Facebook Login in the web application. Check the following tutorials where we’ve used the App ID and App Secret for accessing Facebook APIs (OAuth API, Graph API, etc.).

Do you want to get implementation help, or enhance the functionality of this script? Click here to Submit Service Request

RELATED TUTORIALS

8 Comments

  1. Varun Said...
  2. RENESIO JOAQUIM DE OLIVEIRA COSTA Said...
  3. The Thus Said...
  4. Jen Said...
  5. Sara Patel Said...
  6. Robin Tyagi Said...
  7. Robin Tyagi Said...
    • CodexWorld Said...

Leave a reply

keyboard_double_arrow_up