Sha256: 01c2d3665c5a85c40786d4e5ac7dfc7708dbff940ad7015db64d398cb2bef910

Contents?: true

Size: 697 Bytes

Versions: 1

Compression:

Stored size: 697 Bytes

Contents

require 'omniauth-oauth2'

module OmniAuth
  module Strategies
    class GitLab < OmniAuth::Strategies::OAuth2

      option :client_options, {
          site: 'https://gitlab.com',
          authorize_url: '/oauth/authorize',
          token_url: '/oauth/token'
      }

      uid { raw_info['id'].to_s }

      info do
        {
            name:     raw_info['name'],
            username: raw_info['username'],
            email:    raw_info['email']
        }
      end

      extra do
        { raw_info: raw_info }
      end

      def raw_info
        @raw_info ||= access_token.get('/api/v3/user').parsed
      end
    end
  end
end


OmniAuth.config.add_camelization 'gitlab', 'GitLab'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-gitlab-1.0.0 lib/omniauth/strategies/gitlab.rb