PageRenderTime 48ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/doc/integration/gitlab.md

https://gitlab.com/gerfuls/gitlab-ce
Markdown | 54 lines | 33 code | 21 blank | 0 comment | 0 complexity | 9a5714f902cc77db08f315cc220adfac MD5 | raw file
Possible License(s): CC-BY-3.0
  1. # GitLab OAuth2 OmniAuth Provider
  2. To enable the GitLab OmniAuth provider you must register your application with GitLab. GitLab will generate a client ID and secret key for you to use.
  3. 1. Sign in to GitLab.
  4. 1. Navigate to your settings.
  5. 1. Select "Applications" in the left menu.
  6. 1. Select "New application".
  7. 1. Provide the required details.
  8. - Name: This can be anything. Consider something like "\<Organization\>'s GitLab" or "\<Your Name\>'s GitLab" or something else descriptive.
  9. - Redirect URI:
  10. ```
  11. http://gitlab.example.com/import/gitlab/callback
  12. http://gitlab.example.com/users/auth/gitlab/callback
  13. ```
  14. The first link is required for the importer and second for the authorization.
  15. 1. Select "Submit".
  16. 1. You should now see a Application ID and Secret. Keep this page open as you continue configuration.
  17. 1. On your GitLab server, open the configuration file.
  18. ```sh
  19. cd /home/git/gitlab
  20. sudo -u git -H editor config/gitlab.yml
  21. ```
  22. 1. Find the section dealing with OmniAuth. See [Initial OmniAuth Configuration](README.md#initial-omniauth-configuration) for more details.
  23. 1. Under `providers:` uncomment (or add) lines that look like the following:
  24. ```
  25. - { name: 'gitlab', app_id: 'YOUR APP ID',
  26. app_secret: 'YOUR APP SECRET',
  27. args: { scope: 'api' } }
  28. ```
  29. 1. Change 'YOUR APP ID' to the Application ID from the GitLab application page.
  30. 1. Change 'YOUR APP SECRET' to the secret from the GitLab application page.
  31. 1. Save the configuration file.
  32. 1. Restart GitLab for the changes to take effect.
  33. On the sign in page there should now be a GitLab icon below the regular sign in form. Click the icon to begin the authentication process. GitLab will ask the user to sign in and authorize the GitLab application. If everything goes well the user will be returned to your GitLab instance and will be signed in.