# `Shopifex.Plug.LoadProxyShop`
[🔗](https://github.com/ericdude4/shopifex/blob/main/lib/shopifex/plug/load_proxy_shop.ex#L1)

Resolves the shop from a verified Shopify app-proxy request and makes it
available via `Shopifex.Plug.current_shop/1`.

App-proxy requests carry a signed `shop` param, but `Shopifex.Plug.ValidateHmac`
only verifies the signature — it does not load the shop. Run this plug **after**
`ValidateHmac` (the default `:shopify_proxy` pipeline does) so proxy controllers
can use `Shopifex.Plug.current_shop(conn)`.

Shopify signs the app-proxy **query** params only, so this plug reads `shop`
from `conn.query_params` — the bytes `ValidateHmac` authenticated — not from
`conn.params`, whose value a `POST` body can shadow.

## Options

  * `:on_missing` — what to do when the signed `shop` is absent or not found in
    the database:
    * `:pass` (default) — continue with `current_shop/1` returning `nil`, so
      existing proxy endpoints that don't need the shop are unaffected.
    * `:halt` — respond `401` and halt.

## Example

    pipeline :strict_proxy do
      plug :fetch_session
      plug Shopifex.Plug.FetchFlash
      plug Shopifex.Plug.ValidateHmac
      plug Shopifex.Plug.LoadProxyShop, on_missing: :halt
    end

# `call`

# `init`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
