Menu
AWS Mobile
Developer Guide

Set Up Facebook Authentication

To use the following Facebook service configuration steps to federate Facebook as a user sign-in provider for AWS services called in your app, try the AWS Mobile HubUser Sign-in feature.

You must first register your application with Facebook by using the Facebook Developers portal.

Mobile Hub generates code that enables you to use Facebook to provide federated authentication for your mobile app users. This topic explains how to set up Facebook as an identity provider for your app.

If you already have a Facebook app ID, copy and paste it into the Facebook App ID field in the Mobile Hub console, and choose Save changes.

To get a Facebook app ID

  1. In the Facebook Developers portal, sign in with your Facebook credentials.

  2. From Create App, choose Add a New App (note: this menu label will be My Apps if you have previously created an app.

    
               Adding a new app in the Facebook Developers portal
  3. If asked, choose the platform of your app that will use Facebook sign-in, and basic setup.

  4. Type a display name for your app, select a category for your app from the Category drop-down list, and then choose Create App ID.

    
               Creating a new App ID in the Facebook Developers portal
  5. Complete the Security Check that appears. Your new app then appears in the Dashboard.

    
               New app appearing in the Dashboard of the Facebook Developers portal
  6. Copy the App ID and paste it into the Facebook App ID field in the Mobile Hub console.

    
               Place to type the Facebook App ID in the |AMH| console
  7. In the Facebook Developer portal's left hand navigation list, choose Settings, then choose + Add Platform.

    
               Choose Facebook Developer portal Settings and Add Platform to choose the platform to configure.
  8. Choose your platform and provide information about your Mobile Hub app that Facebook will use for integration during credential validation.

    For iOS:

    1. Add your app's Bundle ID. (ie. com.amazon.YourProjectName). To use the AWS Mobile Hub sample app project, set your this value to com.amazon.MySampleApp.

      
                     Provide Facebook with your iOS app's Bundle ID.

    For Android:

    1. Provide your app's Google Play Package Name. (ie. com.yourprojectname). To use the AWS Mobile Hub sample app project, set this value to com.amazon.mysampleapp.

    2. Provide your Class Name that handles deep links (ie. com.yourprojectname.MainActivity). To use the AWS Mobile Hub sample app project, set your class name to com.mysampleapp.MainActivity.

      
                     Provide Facebook with your Android app's Google Play Package Name.
    3. Provide your app's Facebook development Key Hashes. This is a value that you generate via a terminal in your development environment, and is unique to that environment.

      To generate a development key for your Android environment on Mac, run the following command line.

      keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

      To generate a development key for your Android environment on Windows, run the following command line.

      keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl base64

      For more information, choose the Quick Start button in the upper left of the Facebook Developer Portal Add Platform dialog.

  9. In the Facebook Developers portal, choose Save changes, then Use this package name if a dialog appears saying that Google Play has an issue with your package name.

  10. Only users with roles assigned in the Facebook portal will be abel to authenticate through your app while it is in development (not yet published).

    To authorize users, in the Facebook Developer portal's left hand navigation list, choose Roles, then Add Testers. Provide a valid Facebook ID.

    
               Choose Facebook Developer portal Settings and Add Platform to choose the platform to configure.
  11. In the Mobile Hub console, choose Save changes.

For more information about integrating with Facebook Login, see the Facebook Getting Started Guide.