Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to create OmniAuth strategy aliases
# 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
@mbleigh

This comment has been minimized.

Copy link

commented Aug 11, 2012

You actually should be able to do this:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :google_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,
    name: :adwords_oauth2
  }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.