Sha256: 101a836e5a6a5900367ad149fedec7b7d43944e9881cb0108428f1b992e2a054

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

require 'omniauth/oauth'
require 'multi_json'

module OmniAuth
  module Strategies

    class Flickr < OmniAuth::Strategies::OAuth
      def initialize(app, consumer_key=nil, consumer_secret=nil, options={}, &block)
        scope = options.delete(:scope) || 'read'
        options[:authorize_params] ||= {}
        options[:authorize_params][:perms] = scope

        client_options = {
          :access_token_path => "/services/oauth/access_token",
          :authorize_path => "/services/oauth/authorize",
          :request_token_path => "/services/oauth/request_token",
          :site => "http://www.flickr.com"
        }
        super(app, :flickr, consumer_key, consumer_secret, client_options, options, &block)
      end

      def auth_hash
        OmniAuth::Utils.deep_merge(
          super, {
            'uid' => @access_token.params["user_nsid"],
            'user_info' => user_info
          }
        )
      end

      def user_info
        {
          'username' => @access_token.params["username"],
          'full_name' => @access_token.params["fullname"]
        }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
oa-oauth-0.3.2 lib/omniauth/strategies/oauth/flickr.rb
oa-oauth-0.3.0 lib/omniauth/strategies/oauth/flickr.rb
oa-oauth-0.3.0.rc3 lib/omniauth/strategies/oauth/flickr.rb