Created
May 26, 2011 19:37
-
-
Save he9qi/993884 to your computer and use it in GitHub Desktop.
Set up omniauth for a social website
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SocialAppConfig | |
['twitter', 'renren', 'facebook', 'douban', 'tsina', 'tqq', 't163', 'kaixin', 'tsohu'].each do |auth| | |
raw_config = File.read("#{Rails.root}/config/providers/#{auth}.yml") | |
const_set "#{auth.upcase!}", YAML.load(raw_config)[Rails.env].symbolize_keys | |
end | |
end | |
include SocialAppConfig | |
Rails.application.config.middleware.use OmniAuth::Builder do | |
provider :twitter, TWITTER[:app_id], TWITTER[:app_key] | |
provider :facebook, FACEBOOK[:app_id], FACEBOOK[:app_key], {:scope => "user_photos,user_videos,publish_stream"} | |
provider :renren, RENREN[:api_key], RENREN[:secret_key], {:scope => "publish_feed email read_user_status status_update read_user_photo read_user_like_history"} | |
provider :douban, DOUBAN[:api_key], DOUBAN[:secret_key] | |
provider :tsina, TSINA[:api_key], TSINA[:secret_key] | |
provider :t163, T163[:api_key], T163[:secret_key] | |
provider :tqq, TQQ[:api_key], TQQ[:secret_key] | |
provider :tsohu, TSOHU[:api_key], TSOHU[:secret_key] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment