Shopifex.Plug (Shopifex v2.3.0) View Source
An API for accessing the Shopify session data for the current request.
Link to this section Summary
Functions
Build the Shopifex session. Used in various :shopifex_* pipelines.
Get current request shop resource for give conn.
Get host parameter provided in URL params when Shopify loaded your app in the Shopify admin portal.
Places given shop into current session, making it accessible later on
via Shopifex.Plug.current_shop(conn)
Returns the token for the current session in a plug which has
passed through a :shopify_* pipeline.
Link to this section Types
Specs
Specs
shopify_host() :: String.t()
Link to this section Functions
Specs
build_hmac(conn :: Plug.Conn.t()) :: String.t()
Specs
build_session( conn :: Plug.Conn.t(), shop :: shop(), shopify_host :: shopify_host(), locale :: Gettext.locale() ) :: Plug.Conn.t()
Build the Shopifex session. Used in various :shopifex_* pipelines.
Specs
current_shop(conn :: Plug.Conn.t()) :: shop()
Get current request shop resource for give conn.
Available in all requests which have passed through a :shopify_* pipeline.
Examples:
iex> current_shop(conn)
%MyApp.Shop{}
Specs
current_shopify_host(conn :: Plug.Conn.t()) :: shopify_host()
Get host parameter provided in URL params when Shopify loaded your app in the Shopify admin portal.
Useful when initializing app-bridge instance from SPA application.
Examples:
iex> current_shopify_host(conn)
"host from URL search parameter"
Specs
get_hmac(conn :: Plug.Conn.t()) :: String.t() | nil
Specs
put_shop_in_session(conn :: Plug.Conn.t(), shop :: shop()) :: Plug.Conn.t()
Places given shop into current session, making it accessible later on
via Shopifex.Plug.current_shop(conn)
Specs
session_token(conn :: Plug.Conn.t()) :: Guardian.Token.token() | nil
Returns the token for the current session in a plug which has
passed through a :shopify_* pipeline.
Example
iex> session_token(conn)
"header.payload.signature"