PageRenderTime 51ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/README.md

https://gitlab.com/axil/omniauth2-gitlab
Markdown | 55 lines | 38 code | 17 blank | 0 comment | 0 complexity | df5c3d8b54cc0c688b91f6856be65799 MD5 | raw file
  1. [![Gem Version](https://badge.fury.io/rb/omniauth2-gitlab.svg)](http://badge.fury.io/rb/omniauth2-gitlab)
  2. # Omniauth2::Gitlab
  3. This is the official OmniAuth strategy for authenticating to GitLab. To use it,
  4. you'll need to sign up for an OAuth2 Application ID and Secret on your GitLab
  5. Applications Page (`admin/applications/`).
  6. ## Installation
  7. Add this line to your application's Gemfile:
  8. ```ruby
  9. gem 'omniauth2-gitlab'
  10. ```
  11. And then execute:
  12. $ bundle
  13. Or install it yourself as:
  14. $ gem install omniauth2-gitlab
  15. ## Usage
  16. In your `config/initializers/omniauth.rb`:
  17. ```ruby
  18. Rails.application.config.middleware.use OmniAuth::Builder do
  19. provider :gitlab, ENV['GITLAB_APP_ID'], ENV['GITLAB_SECRET']
  20. end
  21. ```
  22. By default it uses `https://gitlab.com` for authentication. To change to your
  23. site:
  24. ```ruby
  25. Rails.application.config.middleware.use OmniAuth::Builder do
  26. provider :gitlab, ENV['GITLAB_APP_ID'], ENV['GITLAB_SECRET'],
  27. {
  28. :client_options => {
  29. :site => 'https://YOURDOMAIN.com',
  30. }
  31. }
  32. end
  33. ```
  34. Then, register a new application in your GitLab server and start your Rails
  35. application by providing the environment variables `GITLAB_APP_ID` and
  36. `GITLAB_SECRET`.
  37. ## LICENSE
  38. MIT, see [LICENSE](./LICENSE).