How to authenticate using dedicated shop domain using Python API

23 1 19

With the code below I am trying to start authentication/installation of my app on a new store:


def start():
    shopify_domain = request.args.get("shop")"Shopify app authentication started: shopify_domain={shopify_domain}, request.referrer={request.referrer}")
    shopify.Session.setup(api_key=current_app.config.get("shopify-api-key"), secret=current_app.config.get("shopify-api-secret"))
    shopify_session = shopify.Session(shop_url=shopify_domain, version=current_app.config.get("shopify-api-version"))
    permission_url = shopify_session.create_permission_url(shopify_scopes, url_for("shopify_install_bp.finish", _external=True))
    return render_template("shopify_install_bp/start.html", permission_url=permission_url)


This succeeds as long as as I refer to the store with shop argument equal to the myshopify form ( in my case). However as we all know, any respectable store will have a dedicated domain in addition. For my store that domain is and running the code above will try (and fail misserably) to install the app to which is incorrect.

How can I get the correct myshopify name of a store given it's domain at authentication time?
Replies 0 (0)