Sha256: b2eb557ff0f4b701d6e301f373de009d7bbb16e411260196b661ce77a6c19b5e

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require 'omniauth-oauth2'

module OmniAuth
  module Strategies
    class Casenex < OmniAuth::Strategies::OAuth2
      # Give your strategy a name.
      option :name, "casenex"

      # This is where you pass the options you would pass when
      # initializing your consumer from the OAuth gem.
      option :client_options, {
          :site => "https://sharp-stone-1355.herokuapp.com",
          :authorize_url => '/auth/authorize',
          :token_url => '/auth/access_token'
      }

      # These are called after authentication has succeeded. If
      # possible, you should try to set the UID without making
      # additional calls (if the user id is returned with the token
      # or as a URI parameter). This may not be possible with all
      # providers.
      uid{ raw_info['username'] }

      info do
        {
            :username => raw_info['username']
        }
      end

      extra do
        {
            'raw_info' => raw_info
        }
      end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-casenex-0.4 lib/omniauth/strategies/casenex.rb