0
votes

I'm getting started with Shopify app development. I'm developing an embedded Shopify app which will be installed to Shopfify stores. After it is installed I want to have separate web pages for Shopify Store Admin and the Shopify Embedded App's Admin, where they can see stats and perform some actions. (I have no idea whether I should keep these pages on the shopify store domain or an external hosted domain, any advice on which one is appropriate for this use case?)

I'm building it in Ruby on Rails using shopify_app and shopify_api gems. The problem I'm facing is that after app is installed to a Shopify store, by default it is to be redirected to /auth/shopify/callback, which is handled by the shopify_app engine and it redirects the app installer(shopify store owner/merchant) to shopify store's domain(see this code here).

module ShopifyApp
  # Performs login after OAuth completes
  class CallbackController < ActionController::Base
    include ShopifyApp::LoginProtection

    def callback
      return respond_with_error if invalid_request?

      store_access_token_and_build_session

      if start_user_token_flow?
        return respond_with_user_token_flow
      end

      perform_post_authenticate_jobs

      respond_successfully
    end

    private

    def respond_successfully
      if jwt_request?
        head(:ok)
      else
        redirect_to(return_address)
      end
    end
  end
end

and the return_address definition is

def return_address
  return base_return_address unless ShopifyApp.configuration.allow_jwt_authentication
  return_address_with_params(shop: current_shopify_domain)
rescue ShopifyDomainNotFound
  base_return_address
end

What I want to do is that after the app is installed(oauth permission granted) I want to redirect to a custom URL(preferably some external website, which I'll host for the Shopify Store Admin and the Shopiy App Admin), how is it possible?

Essentially what I'm attempting is to go to a custom URL instead of the return_address_with_params(shop: current_shopify_domain) And any pointers on how to handle authentication once we are redirected to that external URL?

I've just started with Shopify App Development and that's why I'm having trouble with understanding these flows. Any help is appreciated.
Thanks

1

1 Answers

1
votes

if you choose the "Embedded APP" during the APP setup, then there is no way to handle the APP in both ways, like in the backend Embed iframe and a separate domain APP.

You choose one of these no both. enter image description here