PageRenderTime 51ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/doc/integration/google.md

https://gitlab.com/williamsodell/gitlab-ce
Markdown | 66 lines | 42 code | 24 blank | 0 comment | 0 complexity | d1ed96b15eee6213b09401b1f418bf15 MD5 | raw file
Possible License(s): CC-BY-3.0
  1. # Google OAuth2 OmniAuth Provider
  2. To enable the Google OAuth2 OmniAuth provider you must register your application with Google. Google will generate a client ID and secret key for you to use.
  3. 1. Sign in to the [Google Developers Console](https://console.developers.google.com/) with the Google account you want to use to register GitLab.
  4. 1. Select "Create Project".
  5. 1. Provide the project information
  6. - Project name: 'GitLab' works just fine here.
  7. - Project ID: Must be unique to all Google Developer registered applications. Google provides a randomly generated Project ID by default. You can use the randomly generated ID or choose a new one.
  8. 1. Refresh the page. You should now see your new project in the list. Click on the project.
  9. 1. Select "APIs & auth" in the left menu.
  10. 1. Select "APIs" in the submenu.
  11. - Enable `Contacts API`
  12. - Enable `Google+ API`
  13. 1. Select "Credentials" in the submenu.
  14. 1. Select "Create New Client ID".
  15. 1. Fill in the required information
  16. - Application type: "Web Application"
  17. - Authorized JavaScript origins: This isn't really used by GitLab but go ahead and put 'https://gitlab.example.com' here.
  18. - Authorized redirect URI: 'https://gitlab.example.com/users/auth/google_oauth2/callback'
  19. 1. Under the heading "Client ID for web application" you should see a Client ID and Client secret (see screenshot). Keep this page open as you continue configuration. ![Google app](google_app.png)
  20. 1. On your GitLab server, open the configuration file.
  21. ```sh
  22. cd /home/git/gitlab
  23. sudo -u git -H editor config/gitlab.yml
  24. ```
  25. 1. Find the section dealing with OmniAuth. See [Initial OmniAuth Configuration](README.md#initial-omniauth-configuration) for more details.
  26. 1. Under `providers:` uncomment (or add) lines that look like the following:
  27. ```
  28. - { name: 'google_oauth2', app_id: 'YOUR APP ID',
  29. app_secret: 'YOUR APP SECRET',
  30. args: { access_type: 'offline', approval_prompt: '' } }
  31. ```
  32. 1. Change 'YOUR APP ID' to the client ID from the GitHub application page from step 7.
  33. 1. Change 'YOUR APP SECRET' to the client secret from the GitHub application page from step 7.
  34. 1. Save the configuration file.
  35. 1. Restart GitLab for the changes to take effect.
  36. On the sign in page there should now be a Google icon below the regular sign in form. Click the icon to begin the authentication process. Google 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.
  37. ## Further Configuration
  38. This further configuration is not required for Google authentication to function but it is strongly recommended. Taking these steps will increase usability for users by providing a little more recognition and branding.
  39. At this point, when users first try to authenticate to your GitLab installation with Google they will see a generic application name on the prompt screen. The prompt informs the user that "Project Default Service Account" would like to access their account. "Project Default Service Account" isn't very recognizable and may confuse or cause users to be concerned. This is easily changeable.
  40. 1. Select 'Consent screen' in the left menu. (See steps 1, 4 and 5 above for instructions on how to get here if you closed your window).
  41. 1. Scroll down until you find "Product Name". Change the product name to something more descriptive.
  42. 1. Add any additional information as you wish - homepage, logo, privacy policy, etc. None of this is required, but it may help your users.