Skip to content

Instantly share code, notes, and snippets.

@yoshuki
Created June 4, 2012 12:44
Show Gist options
  • Save yoshuki/2868125 to your computer and use it in GitHub Desktop.
Save yoshuki/2868125 to your computer and use it in GitHub Desktop.
module OmniAuth
module Strategies
class Facebook
def client
# https://developers.facebook.com/apps にてアプリを登録
#
# apps = {
# 'サイトURL' => {id: 'App ID', secret: 'App Secret'}
# }
apps = {
'http://www.example.com/' => {id: 'AAAAAAAAAAAAAAA',
secret: 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB'},
'http://www.example.net/' => {id: 'CCCCCCCCCCCCCCC',
secret: 'DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD'}
}
if (app = apps["#{request.base_url}/"])
options.client_id = app[:id]
options.client_secret = app[:secret]
end
super
end
end
end
end
Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET']
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment