# `Shopifex.TokenResponse`
[🔗](https://github.com/ericdude4/shopifex/blob/main/lib/shopifex/token_response.ex#L1)

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).

# `shop_attrs`

```elixir
@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`.

---

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