Sha256: 5b69611974a6b8db5936442f65cdd922eb5940eda77a14219e62f865dd2bdbe1

Contents?: true

Size: 996 Bytes

Versions: 1

Compression:

Stored size: 996 Bytes

Contents

require "omniauth/progic_id/version"
require 'omniauth-oauth2'

module OmniAuth
  module Strategies
    class ProgicId < OmniAuth::Strategies::OAuth2
      # change the class name and the :name option to match your application name
      option :name, :progic_id

      option :client_options, {
        :site => "http://localhost:5000",
        :authorize_url => "/oauth/authorize"
      }

      uid { raw_info["id"] }

      info do
        {
          :email => raw_info["email"],
          :name => raw_info["name"],
          :avatar_url => raw_info["avatar_url"]
          # and anything else you want to return to your API consumers
        }
      end

      extra do
        skip_info? ? {} : { :raw_info => raw_info }
      end

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

      # https://github.com/intridea/omniauth-oauth2/issues/81
      def callback_url
        full_host + script_name + callback_path
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-progic_id-0.1.5 lib/omniauth/progic_id.rb