Created
August 10, 2012 15:45
-
-
Save subelsky/3315135 to your computer and use it in GitHub Desktop.
How to create OmniAuth strategy aliases
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
# lib/omniauth-adwords-oauth2.rb | |
require "omniauth-google-oauth2" | |
class AdwordsOauth2 < OmniAuth::Strategies::GoogleOauth2 | |
option :name, 'adwords_oauth2' | |
end | |
# config/initializers/omniauth.rb | |
require "omniauth-adwords-oauth2" | |
Rails.application.config.middleware.use OmniAuth::Builder do | |
provider :adwords_oauth2, ENV['GOOGLE_API_CLIENT_ID'], ENV['GOOGLE_API_CLIENT_SECRET'], { | |
scope: "https://adwords.google.com/api/adwords/" # could also be adwords-sandbox.google.com | |
} | |
end | |
OmniAuth.config.logger = Rails.logger |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You actually should be able to do this: