Skip to content

Chat SDK iOS: Facebook login

bensmiley edited this page Apr 7, 2017 · 5 revisions

The Chat SDK comes preconfigured on our test Facebook accounts meaning there is some configuration required to set up your own project.

NOTE: You will need to have a Firebase account already created to complete this tutorial

Create a Facebook Developers Account

  • Go to the Facebook developers page
  • Create a new app for your project
  • Navigate to the Facebook app page
  • Copy the Facebook AppID

Note: A guide can be found here. You only need to complete step 1.

Now you must configure your app with your Chat SDK project.

  • Open your projects Info.plist

  • Open the chat_sdk -> facebook and add your AppID in the app_id field

  • Add the AppID in the FacebookAppID field in the plist

  • Open URL types -> Item 0 -> URL Schemes and then add your AppID with "fb" at the front (e.g. fb0123456789).

  • Add a new item to the plist called LSApplicationQueriesSchemes of type Array. Add a new entry fbauth2.

Navigate to the settings page of your Facebook developers account

  • Click Add Platform, at the bottom of the screen, and select iOS
  • Add the bundleID of your project to the iOS Bundle ID section
  • Make sure you have a contact email on this page - without it Facebook login will not work.

Note: You can add multiple bundleIDs for a single Facebook app meaning you can use the same Facebook app for multiple versions of your project.

  • Set single sign on to on
  • Set deep linking to off
  • Set Log in-app purchase events automatically to off
  • Click the App Review tab and enable access by the general public

Configuring your Firebase account

  1. Navigate to your Facebook app dashboard
  2. Copy your AppID and App Secret
  3. Navigate to your Firebase dashboard
  4. Click your Firebase app
  5. Click Authentication and then SIGN-IN METHOD
  6. Open the Facebook row and enable Facebook authentication
  7. Enter and save your Facebook AppID and Secret
  8. Copy the OAuth redirect link and navigate back to your Facebook app dashboard
  9. If you do not already have a Facebook Login entry in the Products menu click Add Product. Else click Facebook Login
  10. Add your OAuth redirect to the Valid OAuth redirect URLs field
  11. Save your changes

Facebook is now configured to your custom Chat SDK project