My solution was to make aliases for the google_oauth2 strategy. I didn't see a built-in way to do this, nor did web searches reveal other solutions, so here's what I came up with:
# 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
1 comment:
Thanks a lot for this. I found your blog when I started hating to display 'google_oauth2' publicly :).
Post a Comment