/lib/omniauth/strategies/gitlab.rb
Ruby | 30 lines | 24 code | 6 blank | 0 comment | 0 complexity | 97a2e0002d7ff22689963353aa90ddeb MD5 | raw file
- require 'omniauth-oauth2'
- module OmniAuth
- module Strategies
- class GitLab < OmniAuth::Strategies::OAuth2
- option :name, 'gitlab'
- option :client_options, {
- site: 'https://gitlab.com',
- authorize_url: '/oauth/authorize/',
- token_url: '/oauth/token/'
- }
- uid { raw_info["id"] }
- info do
- {
- email: raw_info["email"],
- username: raw_info["username"],
- name: raw_info["name"]
- }
- end
- def raw_info
- @raw_info ||= access_token.get('/api/v3/user').parsed
- end
- end # GitLab
- end # Strategies
- end # OmniAuth