Skip to content

Commit

Permalink
Merge pull request #417 from tomtaylor/master
Browse files Browse the repository at this point in the history
Added Flickr OAuth provider
  • Loading branch information
sferik committed Aug 3, 2011
2 parents bc9376f + 7d74c0b commit 8eea87a
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 94 deletions.
1 change: 0 additions & 1 deletion oa-more/lib/omniauth/more.rb
Expand Up @@ -3,7 +3,6 @@
module OmniAuth
module Strategies
autoload :WindowsLive, 'omniauth/strategies/windows_live'
autoload :Flickr, 'omniauth/strategies/flickr'
autoload :LastFm, 'omniauth/strategies/last_fm'
autoload :Yupoo, 'omniauth/strategies/yupoo'
autoload :Ign, 'omniauth/strategies/ign'
Expand Down
86 changes: 0 additions & 86 deletions oa-more/lib/omniauth/strategies/flickr.rb

This file was deleted.

7 changes: 0 additions & 7 deletions oa-more/spec/omniauth/strategies/flickr_spec.rb

This file was deleted.

1 change: 1 addition & 0 deletions oa-oauth/lib/omniauth/oauth.rb
Expand Up @@ -9,6 +9,7 @@ module Strategies
autoload :Dropbox, 'omniauth/strategies/oauth/dropbox'
autoload :Evernote, 'omniauth/strategies/oauth/evernote'
autoload :Flattr, 'omniauth/strategies/oauth/flattr'
autoload :Flickr, 'omniauth/strategies/oauth/flickr'
autoload :Goodreads, 'omniauth/strategies/oauth/goodreads'
autoload :Google, 'omniauth/strategies/oauth/google'
autoload :GoogleHealth, 'omniauth/strategies/oauth/google_health'
Expand Down
39 changes: 39 additions & 0 deletions oa-oauth/lib/omniauth/strategies/oauth/flickr.rb
@@ -0,0 +1,39 @@
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
6 changes: 6 additions & 0 deletions oa-oauth/spec/omniauth/strategies/oauth/flickr_spec.rb
@@ -0,0 +1,6 @@
require 'spec_helper'

describe OmniAuth::Strategies::Flickr do
it_should_behave_like "an oauth strategy"
end

0 comments on commit 8eea87a

Please sign in to comment.