---
updatedAt: 2025-07-15T08:36:44.000Z
agentTools:
  projectIndex: https://docs.appery.io/llms.txt
---

# Ionic Facebook Login Plugin App

Sample Ionic app using Facebook API.

# Introduction

This sample app shows you how to add a social login feature to your application using the **[Facebook Login](https://docs.appery.io/docs/apperyio-social-networking#facebook-login)** Appery.io plugin.

> 📘
>
> If you are looking for video instructions on how to to create an Ionic application with the functionality of social authentication via Facebook by adding the **Facebook Login** plugin, you might like this video tutorial:

<HTMLBlock>{`
<iframe width="610" height="315" src="https://www.youtube.com/embed/zK8g7qjwNeg" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
`}</HTMLBlock>

But if you are interested in the detailed tutorials, please follow the steps below. So, to create the app:

# Getting the App

1. From the **[App](https://appery.io/app/projects)** page, select **[Create new app](https://docs.appery.io/docs/1-creating-an-app-ui-palette#creating-new-app) > [Ionic Blank](https://docs.appery.io/docs/ionic-5-app-templates#ionic-5-blank)** and click the **Create** button.
2. In the **CREATE NEW** dropdown, select **From Plugin**, scroll down to the **[Social Networking](https://docs.appery.io/docs/apperyio-social-networking)** section and check the **[Facebook Login](https://docs.appery.io/docs/apperyio-social-networking#facebook-login)** plugin, and press the **Import selected plugins** button:

<Image align="center" className="border" border={true} src="https://files.readme.io/2d76fc4-08-12_15.28..png" />

All the needed pages and defined services will be imported instantly under the [**Project** view](https://docs.appery.io/docs/apperyio-visual-builder#project-view):

<Image align="center" className="border" width="smart" border={true} src="https://files.readme.io/b6fe42c-08-12_15.29..png" />

You can review the application in the **[App Builder](https://docs.appery.io/docs/apperyio-visual-builder)** by switching between the pages and/or services:

<Image align="center" className="border" border={true} src="https://files.readme.io/43cb66c-Screenshot_3.png" />

You can even check the app behavior in the preview:

1. Open the **Project >[Routing](https://docs.appery.io/docs/4-routing-and-navigation#using-routing)** tab.
2. Change the default route page to ***FacebookLoginScreen*** and save:

![](https://files.readme.io/100a8b0-08-12_15.36..png "08-12 15.36..png")

3. Next, click the **TEST** button in the **[App Builder](https://docs.appery.io/docs/apperyio-visual-builder)** **[Toolbar](https://docs.appery.io/docs/apperyio-visual-builder#toolbar)** to open the app in preview where you can press the buttons to show the service response with the predefined data:

<Image align="center" className="border" width="smart" border={true} src="https://files.readme.io/dc5be60-FB1.gif" />

Now to make it work in full mode, we need to configure the application so that it can be connected to the Facebook API.

# Getting App Backend

Now, to get the native application, you need to define the app backend:

## Registering Facebook App

Log in or sign up to [developers.facebook.com](http://developers.facebook.com/).

> 👍 Note
>
> You should have a verified Facebook account.\
> Read [here](https://www.facebook.com/help/167551763306531) for more information.

1. Go to <http://developers.facebook.com/> and log in.
2. Click **My Apps > Create App**.
3. In the new window, select the needed app type (here, **Consumer**) and confirm by clicking **Next**:

<Image align="center" className="border" border={true} src="https://files.readme.io/e8fa6e1-08-12_15.45..png" />

4. A new window opens where you can provide the app nameand confirm creating it:

<Image align="center" className="border" border={true} src="https://files.readme.io/080e13c-08-12_15.49..png" />

5. Then, if asked, complete the security check and start with adding the **Facebook Login** product.

<Image align="center" className="border" border={true} src="https://files.readme.io/3d07fe8-08-12_15.57..png" />

6. Click **Set Up** and, in the new window, select the needed platform:

<Image align="center" className="border" border={true} src="https://files.readme.io/76dd2f5-08-12_15.59..png" />

We will start with setting the iOS platform up so let's select it.

## Defining for iOS platform

1. The first item does not need to be defined, so skip it by pressing **Next**:

<Image align="center" className="border" border={true} src="https://files.readme.io/6b7a5d0-08-12_16.03..png" />

2. For the app *Bundle ID*, go back to your ***Ionic Facebook Login App*** and open the **App settings >[iOS binary](https://docs.appery.io/docs/appbuilder-app-settings#ios-binary)** tab:

<Image align="center" className="border" border={true} src="https://files.readme.io/e6bdb92-08-12_16.04..png" />

3. Copy it to the clipboard, switch back to your ***[Facebook for Developers](https://developers.facebook.com/apps/)*** dashboard, paste it into the field provided and click **Save**; then **Continue**:

<Image align="center" className="border" border={true} src="https://files.readme.io/fdf01a3-08-12_16.05..png" />

4. In the next step, enable the **Single Sign On** option, save and proceed to *Step 4:*

<Image align="center" className="border" border={true} src="https://files.readme.io/a6d9035-08-12_16.06..png" />

5. The other steps do not require entering any user information, so you can just skip them all by pressing the **Next** button for every item.
6. When ready, open the **Basic** settings tab, provide the **Privacy Policy URL** and **Data deletion instructions URL** (in this case, ***<https://appery.io/privacy-statement>*** and ***<https://appery.io/terms-of-use>***), select the **Category** (here, ***Business and Pages***) and, if needed, upload the app icon. Save.
7. Then, click the **In Development** toggle - this will switch the project to **Live** and, lastly, click **Save changes**:

<Image align="center" className="border" border={true} src="https://files.readme.io/ec5b1bf-08-12_16.39..png" />

> 👍 Note the App ID
>
> Now, when the app is saved, copy the **App ID**, which will be used to configure the **Facebook API** plug-in:

<Image align="center" className="border" border={true} src="https://files.readme.io/1c7b3ea-08-12_16.46..png" />

The project is now ready for integration!

### iOS App Settings

1. Go back to your **Ionic Facebook Login App**, open the **App settings > Cordova plugins >[Core Cordova plugins](https://docs.appery.io/docs/appbuilder-app-settings#core-cordova-plugins)** tab, make sure that the ***Facebook Connect*** plug-in is enabled and click its **Options** button:

<Image align="center" className="border" border={true} src="https://files.readme.io/799c7ac-08-12_16.45..png" />

2. Since the **App ID** is copied to your clipboard, paste it into the **APP\_ID** field, the **APP\_NAME** is ***Appery\_Login***.
3. Click **Save options** to complete:

<Image align="center" className="border" border={true} src="https://files.readme.io/adc23b1-08-12_16.48..png" />

4. Finally, you are ready to publish the app. To do it, go to the **[iOS binary](https://docs.appery.io/docs/appbuilder-app-settings#ios-binary)** tab, scroll down and upload your *Apple certificate* (`.p12`) and *provisioning profile* (`.provision`) under the corresponding sections:

<Image align="center" className="border" border={true} src="https://files.readme.io/16d3977-08-12_17.34..png" />

5. You are now ready to [export](https://docs.appery.io/docs/appexport-ios) the app.

> 👍 Building an iOS binary
>
> If you need assistance on where you can get the Apple certificates, visit this page: <https://docs.appery.io/docs/appexport-ios#publishing-for-ios>.

### Testing iOS App

This is how the app should look like when it starts on an iOS device:

<Image align="center" className="border" border={true} src="https://files.readme.io/4d4c586-IMG_7468.PNG" />

Click **Continue with Facebook**:

<Image align="center" className="border" width="smart" border={true} src="https://files.readme.io/d8640a3-08-12_18.15..png" />

After you confirm, you will be successfully logged in:

<Image align="center" className="border" border={true} src="https://files.readme.io/fb8c661-Untitled2.png" />

> 🚧 Important iOS information
>
> For the app to work on the iOS platform you must set the project to **Public**.

## Defining for the Android platform

If you also need to add login on Android devices, you can follow the flow similar to what was done for [iOS](https://docs.appery.io/docs/ionic-5-facebook-login-plug-in-app#defining-for-the-android-platform).

1. First, open your Facebook project on ***Facebook for Developers*** (<https://developers.facebook.com/apps/>), unfold the **PRODUCTS > Quickstart** folder and select the **Android** platform:

<Image align="center" className="border" border={true} src="https://files.readme.io/65436f2-08-12_17.43..png" />

2. Skip the first two steps by pressing **Next**.
3. In *Step 3*, you will need to define the package name. To locate it, go back to your Appery.io **Ionic Facebook Login App** **App settings >[Android binary](https://docs.appery.io/docs/appbuilder-app-settings#android-binary)** tab, then copy it to the clipboard:

<Image align="center" className="border" border={true} src="https://files.readme.io/99abc17-08-12_17.45..png" />

4. Back in your Facebook project, insert the package name into the corresponding field. Also, duplicate this name as the main activity. Click **Save** and then **Continue**:

<Image align="center" className="border" border={true} src="https://files.readme.io/40fa7a8-08-12_17.48..png" />

In *Step 4*, you will be required to provide your key hash.

5. To get it from your app, first, open **App settings >[Android binary](https://docs.appery.io/docs/appbuilder-app-settings#android-binary)** and select the ***Release (APK)*** build type option:

<Image align="center" className="border" border={true} src="https://files.readme.io/ba05f93-08-12_17.58..png" />

6. Then, go to the **[Resources](https://appery.io/app/res)** tab and click **Export to zip** for the default *apperyio.project* certificate to save it to your drive:

<Image align="center" className="border" border={true} src="https://files.readme.io/55ec747-08-12_18.03..png" />

7. Now, unpack the archive and copy the hash value of your certificate (here, it is the *apperyio.project* `SHA1` file):

<Image align="center" className="border" border={true} src="https://files.readme.io/2596988-08-12_18.18..png" />

> 👍
>
> You can use any word editor to open the file, for example **[Notepad++](https://notepad-plus-plus.org/downloads/)**.

8. Now, let's convert this `Hex` value to base 64 format on <https://base64.guru/converter/encode/hex>:

<Image align="center" className="border" width="smart" border={true} src="https://files.readme.io/a6a1fe2-08-12_18.25..png" />

9. You can now copy this Base 64 code and paste it into the **Key Hashes** field. Save and click **Continue**:

<Image align="center" className="border" border={true} src="https://files.readme.io/abdd57e-08-12_18.27..png" />

10. In the next step, enable the **Single Sign On** option and save. Click **Next**:

<Image align="center" className="border" border={true} src="https://files.readme.io/4343d19-08-12_18.28..png" />

11. The other steps do not require entering any user information, so you can just skip them all by pressing the **Next** button for every item.

Actually, your app is ready and you can [build](https://docs.appery.io/docs/appexport-android) the app `apk` to install it on your device for testing:

### Testing Android App

This is how it should look like on the Android device with the actual Facebook profile:

<Image align="center" className="border" width="smart" border={true} src="https://files.readme.io/ac28d29-Screenshot_6.png" />