Sha256: 98852e3d272ce32f64481b0c2b1815959a10fbf45b3a818a6702f5b945e706f3

Contents?: true

Size: 844 Bytes

Versions: 1

Compression:

Stored size: 844 Bytes

Contents

require 'omniauth-oauth2'

module OmniAuth
  module Strategies
    class Tanmer < OmniAuth::Strategies::OAuth2

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

      option :redirect_url

      uid { raw_info['uid'] }

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

      extra do
        { raw_info: raw_info }
      end

      def raw_info
        @raw_info ||= access_token.get('/api/v1/users/profile').parsed
      end

      private

      def callback_url
        options.redirect_url || (full_host + script_name + callback_path)
      end
    end
  end
end

OmniAuth.config.add_camelization 'tanmer', 'Tanmer'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-tanmer-1.0.4 lib/omniauth/strategies/tanmer.rb