Last active
August 13, 2018 00:34
-
-
Save matias-eduardo/75b5efeef66a7d59e62a2bb42c5d8045 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| Rails.application.config.middleware.use OmniAuth::Builder do | |
| # Offline auth | |
| provider :shopify, | |
| ShopifyApp.configuration.api_key, | |
| ShopifyApp.configuration.secret, | |
| scope: ShopifyApp.configuration.scope, | |
| setup: lambda { |env| | |
| strategy = env['omniauth.strategy'] | |
| shopify_auth_params = strategy.session['shopify.omniauth_params']&.with_indifferent_access | |
| shop = if shopify_auth_params.present? | |
| "https://#{shopify_auth_params[:shop]}" | |
| else | |
| '' | |
| end | |
| strategy.options[:client_options][:site] = shop | |
| } | |
| # Online auth | |
| provider :shopify, | |
| ShopifyApp.configuration.api_key, | |
| ShopifyApp.configuration.secret, | |
| scope: ShopifyApp.configuration.scope, | |
| per_user_permissions: true, | |
| setup: lambda { |env| | |
| strategy = env['omniauth.strategy'] | |
| shopify_auth_params = strategy.session['shopify.omniauth_params']&.with_indifferent_access | |
| shop = if shopify_auth_params.present? | |
| "https://#{shopify_auth_params[:shop]}" | |
| else | |
| '' | |
| end | |
| strategy.options[:client_options][:site] = shop | |
| } | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I assume both sessions would clash here right?