diff --git a/README.md b/README.md index 51f5d47e1..920df7e2e 100644 --- a/README.md +++ b/README.md @@ -199,14 +199,6 @@ This will create the Shopify engine routes under the specified subpath, as a res callback_path: '/nested/auth/shopify/callback' ``` -To use named routes with the engine so that it can route between the application and the engine's routes it should be prefixed with `main_app` or `shopify_app`. - -```ruby -main_app.login_path # For a named login route on the rails app. - -shopify_app.login_path # For the shopify app store login route. -``` - Managing Api Keys ----------------- diff --git a/lib/shopify_app/controller_concerns/login_protection.rb b/lib/shopify_app/controller_concerns/login_protection.rb index 07f576ab5..6182f2b0a 100644 --- a/lib/shopify_app/controller_concerns/login_protection.rb +++ b/lib/shopify_app/controller_concerns/login_protection.rb @@ -54,7 +54,7 @@ def close_session def main_or_engine_login_url(params = {}) main_app.login_url(params) rescue NoMethodError - shopify_app.login_url(params) + shopify_app_engine.login_url(host: "https://#{request.host}", params: params) end def fullpage_redirect_to(url) @@ -115,5 +115,10 @@ def sanitize_shop_param(params) ShopifyApp::Utils.sanitize_shop_domain(params[:shop]) end + private + + def shopify_app_engine + ShopifyApp::Engine.routes.url_helpers + end end end