Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switching providers in the Rails app, based on the request.domain of a request? #67

Open
ChristofferJoergensen opened this issue May 24, 2018 · 0 comments

Comments

@ChristofferJoergensen
Copy link

The initializer for this gem is supposed to look like this:

# config/initializers/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
  provider :shopify, ENV['SHOPIFY_API_KEY'], ENV['SHOPIFY_SHARED_SECRET']
end

However, in our Rails app resides a few different brands who offers the same functionality. Through out the entire app, the request.domain of a request determines which brand you are exposed to (brand1.example.com, brand2.example.com, etc.).

We can easily store brand specific credentials and redirect the users to the brand specific authorization path:

https://example.myshopify.com/admin/oauth/authorize?client_id=brand1&scope=read_orders,read_products&redirect_uri=https://brand1.example.com/auth/shopify/callback

But it's less clear how we administrate having different providers for the middleware, chosen based on the visited request.domain. Any idea how to set this up?

@ChristofferJoergensen ChristofferJoergensen changed the title Switching providers in the Rails app, based on the request.domain of a request? Switching providers in the Rails app, based on the request.domain of a request? May 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant