Skip to content

Enabling Facebook Login

Note this step may be done any time before publishing your app, but your Facebook Login will not work until then. If you prefer not to provide this login method to the users, please inform Exosite to turn off the related cloud settings.

To enable Facebook Login in your app, please follow below steps.

Set Up Facebook App

Steps

  1. Log into Meta for developers and click Create App on the top right of the page.

  2. Select Consumer and click Next.

  3. Fill out your Display name and APP contact email then click Create App. Note you can change this later in the Settings.

  4. Re-enter your developer's password and click Submit.

  5. After turning to the main page, please click set up icon on the Facebook Login function.

  6. Select iOS and follow the instructions.

    (1) Set up Your Development Environment: no need to change anything and click Next.

    (2) Fill in the Bundle ID, hit Save and then Continue.

    You can find your Bundle ID in your config.xml file on the root of your project.

    (3) Choose yes for Enable Single Sign On. Click Save and then Next.

    (4) Skip the following questions.

  7. Click Quickstart under Facebook Login on the left navigation menu. Select Android and follow the instructions.

    (1) Click Download the Facebook SDK for Android and click Next.

    (2) Jump to the 3rd question and fill in the Package Name and Default Activity Class Name. Click Save and then Continue.

    You can find the package name in config.xml file. Default activity class name is your package name plus .MainActivity. For example, if your package name iscom.example.mobile, then your default activity class name will be com.example.mobile.MainActivity

    (3) Fill in the Key Hashes. You can refer here for how to generate a key hash for developer environment.

    (4) Choose yes for Enable Single Sign On. Click Save and then Next.

    (5) Skip the following questions.

Set Up Facebook Login Setting

Steps

  1. Click Settings under Facebook Login on the left navigation menu.

  2. Enter the following URL in the Valid OAuth redirect URIs field.

    https://<my_domain>/api:1/social/handle/Facebook

  3. Make sure the Client OAuth login, Web OAuth login, Use Strict Mode for redirect URIs, Enforce HTTPS, Embedded Browser OAuth Login, and Login from Devices are enabled.

  4. Click Save Changes.

  5. Finally, you must provide your App ID and App Secret to Exosite to enable your solution for Facebook Login. (You can find them on Settings → Basic.)

Update Your App Project

You may either use the env.sh file for configuration or manually modify the information in package.json and config.xml.

Use env.shfile to update

  1. Open ~/customer/common/env.sh
  2. Copy Client token content into fb_client_token and save. This info can be found on Settings → Advanced page.

Manually set

Update the Facebook info manually by the following instructions:

  1. Update the APP_ID, APP_NAME, and the CLIENT_TOKEN in your "package.json" file.

  2. Reinstall your app dependencies and platforms. Any time you change your "config.xml" or "package.json", you need to do the following remove commands and then reinstall the dependencies and platforms.

    (1) Remove node_modules, plugins and platforms

    cd hamv_mobile
    rm -rf node_modules
    rm -rf plugins
    rm -rf platforms
    

    (2) Remove platform

    ionic cordova platform rm android
    ionic cordova platform rm ios
    

    (3) Reinstall project dependencies

    npm install
    

    (4) Reinstall platforms

    ionic cordova platform add android
    ionic cordova platform add ios
    
  3. Open app.config.ts file, under ~/src/app/. Modify the signinMethod value to true.

Publish Your Facebook App

Steps

  1. Go to Meta for developer and select your app.

  2. Click SettingsBasic on the left navigation menu.

  3. Complete the information needed and click Save Changes.

  4. Once the settings are done, please switch the App mode to Live.

  5. Congratulations! Your app can be accessed through Facebook login service.


Have more questions? Submit a request