Shopifex.TokenResponse (Shopifex v3.0.0)

Copy Markdown View Source

Builds the shop attrs map persisted from a decoded Shopify OAuth access-token response.

Both the legacy authorization-code grant (ShopifexWeb.AuthController) and the managed-install token exchange (Shopifex.Plug.ManagedInstall) parse the same response shape and funnel through here, so token-lifecycle handling (expires_in / refresh_token_expires_in -> *_expires_at) isn't duplicated or left to drift between the two flows.

Only a fixed set of known fields is read from body — unknown keys are dropped, never turned into atoms (no String.to_atom/1 on external input).

Summary

Functions

Builds the atom-keyed shop attrs map for shop_url from a decoded Shopify OAuth access-token response body.

Functions

shop_attrs(shop_url, body)

@spec shop_attrs(String.t(), map()) :: map()

Builds the atom-keyed shop attrs map for shop_url from a decoded Shopify OAuth access-token response body.

Tolerates a response without expires_in / refresh_token (non-expiring tokens, used by older installs or test fixtures) — the expiry timestamps stay nil.