debian-mirror-gitlab/doc/integration/facebook.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

117 lines
3.4 KiB
Markdown
Raw Normal View History

2021-01-29 00:20:46 +05:30
---
2022-07-16 23:28:13 +05:30
stage: Manage
group: Authentication and Authorization
2022-11-25 23:54:43 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2021-01-29 00:20:46 +05:30
---
2021-11-11 11:23:49 +05:30
# Facebook OAuth 2.0 OmniAuth Provider **(FREE)**
2015-11-26 14:37:03 +05:30
2021-11-11 11:23:49 +05:30
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.
2015-11-26 14:37:03 +05:30
2019-09-30 21:07:59 +05:30
1. Sign in to the [Facebook Developer Platform](https://developers.facebook.com/).
2015-11-26 14:37:03 +05:30
1. Choose "My Apps" > "Add a New App"
1. Select the type "Website"
2021-11-11 11:23:49 +05:30
1. 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.
2015-11-26 14:37:03 +05:30
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-10-12 21:52:04 +05:30
![Facebook Website URL](img/facebook_website_url.png)
2015-11-26 14:37:03 +05:30
1. Choose "Next"
2023-05-27 22:25:52 +05:30
1. In the upper-right corner, select **Skip Quick Start**.
2015-11-26 14:37:03 +05:30
1. Choose "Settings" in the menu on the left
1. Fill in a contact email for your app
2019-10-12 21:52:04 +05:30
![Facebook App Settings](img/facebook_app_settings.png)
2015-11-26 14:37:03 +05:30
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"
2021-11-11 11:23:49 +05:30
1. You should now see an app key and app secret (see screenshot). Keep this page
open as you continue configuration.
2015-11-26 14:37:03 +05:30
2019-10-12 21:52:04 +05:30
![Facebook API Keys](img/facebook_api_keys.png)
2015-11-26 14:37:03 +05:30
2019-09-30 21:07:59 +05:30
1. On your GitLab server, open the configuration file.
2015-11-26 14:37:03 +05:30
2019-12-04 20:38:33 +05:30
For Omnibus package:
2015-11-26 14:37:03 +05:30
2020-03-13 15:44:24 +05:30
```shell
2019-09-30 21:07:59 +05:30
sudo editor /etc/gitlab/gitlab.rb
```
2015-11-26 14:37:03 +05:30
2019-09-30 21:07:59 +05:30
For installations from source:
2015-11-26 14:37:03 +05:30
2020-03-13 15:44:24 +05:30
```shell
2019-09-30 21:07:59 +05:30
cd /home/git/gitlab
2015-11-26 14:37:03 +05:30
2019-09-30 21:07:59 +05:30
sudo -u git -H editor config/gitlab.yml
```
2015-11-26 14:37:03 +05:30
2023-04-23 21:23:45 +05:30
1. Edit the [common configuration file settings](omniauth.md#configure-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.
2015-11-26 14:37:03 +05:30
2019-09-30 21:07:59 +05:30
1. Add the provider configuration:
2015-11-26 14:37:03 +05:30
2019-12-04 20:38:33 +05:30
For Omnibus package:
2015-11-26 14:37:03 +05:30
2019-09-30 21:07:59 +05:30
```ruby
gitlab_rails['omniauth_providers'] = [
{
2022-01-26 12:08:38 +05:30
name: "facebook",
# label: "Provider name", # optional label for login button, defaults to "Facebook"
app_id: "YOUR_APP_ID",
app_secret: "YOUR_APP_SECRET"
2019-09-30 21:07:59 +05:30
}
]
```
2015-11-26 14:37:03 +05:30
2019-09-30 21:07:59 +05:30
For installations from source:
2015-11-26 14:37:03 +05:30
2020-04-22 19:07:51 +05:30
```yaml
2022-01-26 12:08:38 +05:30
- { name: 'facebook',
# label: 'Provider name', # optional label for login button, defaults to "Facebook"
app_id: 'YOUR_APP_ID',
2021-01-03 14:25:43 +05:30
app_secret: 'YOUR_APP_SECRET' }
2019-09-30 21:07:59 +05:30
```
2015-11-26 14:37:03 +05:30
2019-09-30 21:07:59 +05:30
1. Change 'YOUR_APP_ID' to the API key from Facebook page in step 10.
2015-11-26 14:37:03 +05:30
2019-09-30 21:07:59 +05:30
1. Change 'YOUR_APP_SECRET' to the API secret from the Facebook page in step 10.
2015-11-26 14:37:03 +05:30
2019-09-30 21:07:59 +05:30
1. Save the configuration file.
2015-11-26 14:37:03 +05:30
2022-10-11 01:57:18 +05:30
1. For the changes to take effect:
- If you installed via Omnibus, [reconfigure GitLab](../administration/restart_gitlab.md#omnibus-gitlab-reconfigure).
- If you installed from source, [restart GitLab](../administration/restart_gitlab.md#installations-from-source).
2015-11-26 14:37:03 +05:30
2021-11-11 11:23:49 +05:30
On the sign in page there should now be a Facebook icon below the regular sign
2022-07-23 23:45:48 +05:30
in form. Select the icon to begin the authentication process. Facebook asks the
2021-11-11 11:23:49 +05:30
user to sign in and authorize the GitLab application. If everything goes well
the user is returned to GitLab and signed in.