Use Facebook as an OAuth 2.0 authentication provider (FREE ALL)

To enable the Facebook OmniAuth provider you must register your application with Facebook. Facebook generates an app ID and secret key for you to use.

  1. Sign in to the Facebook Developer Platform.

  2. Choose "My Apps" > "Add a New App"

  3. Select the type "Website"

  4. Enter a name for your app. This can be anything. Consider something like "<Organization>'s GitLab" or "<Your Name>'s GitLab" or something else descriptive.

  5. Choose "Create New Facebook App ID"

  6. Select a Category, for example "Productivity"

  7. Choose "Create App ID"

  8. Enter the address of your GitLab installation at the bottom of the package

    Facebook Website URL

  9. Choose "Next"

  10. In the upper-right corner, select Skip Quick Start.

  11. Choose "Settings" in the menu on the left

  12. Fill in a contact email for your app

    Facebook App Settings

  13. Choose "Save Changes"

  14. Choose "Status & Review" in the menu on the left

  15. Change the switch on the right from No to Yes

  16. Choose "Confirm" when prompted to make the app public

  17. Choose "Dashboard" in the menu on the left

  18. Choose "Show" next to the hidden "App Secret"

  19. You should now see an app key and app secret (see screenshot). Keep this page open as you continue configuration.

    Facebook API Keys

  20. On your GitLab server, open the configuration file.

    For Linux package installations:

    sudo editor /etc/gitlab/gitlab.rb

    For self-compiled installations:

    cd /home/git/gitlab
    
    sudo -u git -H editor config/gitlab.yml
  21. Configure the common settings to add facebook as a single sign-on provider. This enables Just-In-Time account provisioning for users who do not have an existing GitLab account.

  22. Add the provider configuration.

    For Linux package installations:

    gitlab_rails['omniauth_providers'] = [
      {
        name: "facebook",
        # label: "Provider name", # optional label for login button, defaults to "Facebook"
        app_id: "YOUR_APP_ID",
        app_secret: "YOUR_APP_SECRET"
      }
    ]

    For self-compiled installations:

    - { name: 'facebook',
        # label: 'Provider name', # optional label for login button, defaults to "Facebook"
        app_id: 'YOUR_APP_ID',
        app_secret: 'YOUR_APP_SECRET' }
  23. Change 'YOUR_APP_ID' to the API key from Facebook page in step 10.

  24. Change 'YOUR_APP_SECRET' to the API secret from the Facebook page in step 10.

  25. Save the configuration file.

  26. For the changes to take effect:

On the sign in page there should now be a Facebook icon below the regular sign in form. Select the icon to begin the authentication process. Facebook asks the user to sign in and authorize the GitLab application. If everything goes well the user is returned to GitLab and signed in.