2015-11-03 11:58:12 -05:00
# Facebook OAuth2 OmniAuth Provider
To enable the Facebook OmniAuth provider you must register your application with Facebook. Facebook will generate an app ID and secret key for you to use.
2019-07-11 11:21:26 -04:00
1. Sign in to the [Facebook Developer Platform ](https://developers.facebook.com/ ).
2015-11-03 11:58:12 -05:00
1. Choose "My Apps" > "Add a New App"
1. Select the type "Website"
1. Enter a name for your app. This can be anything. Consider something like "< Organization> 's GitLab" or "< Your Name> 's GitLab" or
2019-02-22 08:17:10 -05:00
something else descriptive.
2015-11-03 11:58:12 -05:00
1. Choose "Create New Facebook App ID"
1. Select a Category, for example "Productivity"
1. Choose "Create App ID"
1. Enter the address of your GitLab installation at the bottom of the package
2019-08-12 05:53:30 -04:00
![Facebook Website URL ](img/facebook_website_url.png )
2015-11-03 11:58:12 -05:00
1. Choose "Next"
1. Choose "Skip Quick Start" in the upper right corner
1. Choose "Settings" in the menu on the left
1. Fill in a contact email for your app
2015-11-03 16:16:15 -05:00
2019-08-12 05:53:30 -04:00
![Facebook App Settings ](img/facebook_app_settings.png )
2015-11-03 11:58:12 -05:00
1. Choose "Save Changes"
1. Choose "Status & Review" in the menu on the left
1. Change the switch on the right from No to Yes
1. Choose "Confirm" when prompted to make the app public
1. Choose "Dashboard" in the menu on the left
1. Choose "Show" next to the hidden "App Secret"
1. You should now see an app key and app secret (see screenshot). Keep this page open as you continue configuration.
2019-08-12 05:53:30 -04:00
![Facebook API Keys ](img/facebook_api_keys.png )
2015-11-03 11:58:12 -05:00
2019-07-11 11:21:26 -04:00
1. On your GitLab server, open the configuration file.
2015-11-03 11:58:12 -05:00
2019-08-27 04:41:50 -04:00
For Omnibus package:
2015-11-03 11:58:12 -05:00
2020-01-30 10:09:15 -05:00
```shell
2019-07-11 11:21:26 -04:00
sudo editor /etc/gitlab/gitlab.rb
```
2015-11-03 11:58:12 -05:00
2019-07-11 11:21:26 -04:00
For installations from source:
2015-11-03 11:58:12 -05:00
2020-01-30 10:09:15 -05:00
```shell
2019-07-11 11:21:26 -04:00
cd /home/git/gitlab
2015-11-03 11:58:12 -05:00
2019-07-11 11:21:26 -04:00
sudo -u git -H editor config/gitlab.yml
```
2015-11-03 11:58:12 -05:00
2019-07-11 11:21:26 -04:00
1. See [Initial OmniAuth Configuration ](omniauth.md#initial-omniauth-configuration ) for initial settings.
2015-11-03 11:58:12 -05:00
2019-07-11 11:21:26 -04:00
1. Add the provider configuration:
2015-11-03 11:58:12 -05:00
2019-08-27 04:41:50 -04:00
For Omnibus package:
2015-11-03 11:58:12 -05:00
2019-07-11 11:21:26 -04:00
```ruby
gitlab_rails['omniauth_providers'] = [
{
"name" => "facebook",
"app_id" => "YOUR_APP_ID",
"app_secret" => "YOUR_APP_SECRET"
}
]
```
2015-11-03 11:58:12 -05:00
2019-07-11 11:21:26 -04:00
For installations from source:
2015-11-03 11:58:12 -05:00
2020-03-23 23:09:28 -04:00
```yaml
2019-07-11 11:21:26 -04:00
- { name: 'facebook', app_id: 'YOUR_APP_ID',
app_secret: 'YOUR_APP_SECRET' }
```
2015-11-03 11:58:12 -05:00
2019-07-11 11:21:26 -04:00
1. Change 'YOUR_APP_ID' to the API key from Facebook page in step 10.
2015-11-03 11:58:12 -05:00
2019-07-11 11:21:26 -04:00
1. Change 'YOUR_APP_SECRET' to the API secret from the Facebook page in step 10.
2015-11-03 11:58:12 -05:00
2019-07-11 11:21:26 -04:00
1. Save the configuration file.
2015-11-03 11:58:12 -05:00
2020-04-06 08:10:44 -04:00
1. [Reconfigure ](../administration/restart_gitlab.md#omnibus-gitlab-reconfigure ) or [restart GitLab ](../administration/restart_gitlab.md#installations-from-source ) for the changes to take effect if you
2019-07-11 11:21:26 -04:00
installed GitLab via Omnibus or from source respectively.
2015-11-03 11:58:12 -05:00
On the sign in page there should now be a Facebook icon below the regular sign in form. Click the icon to begin the authentication process. Facebook will ask the user to sign in and authorize the GitLab application. If everything goes well the user will be returned to GitLab and will be signed in.