# `YahooFinanceEx.Session`
[🔗](https://github.com/fleveque/yahoo_finance_ex/blob/v0.13.0/lib/yahoo_finance_ex/session.ex#L1)

Holds Yahoo Finance auth state (cookie + CSRF crumb) for the running app.

Yahoo's public API gates calls behind a per-session cookie and a crumb
token that must be present on every request. This GenServer owns both,
refreshes them when needed, and exposes a lookup function callers use
before each HTTP call.

Two strategies for obtaining a valid (cookie, crumb) pair are tried in
order before giving up. Both rely on `Req` and are stubbable in tests
via `Req.Test`.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `credentials`

```elixir
@spec credentials(GenServer.server()) ::
  {:ok, YahooFinanceEx.Session.Credentials.t()} | {:error, term()}
```

Returns `{:ok, %Credentials{}}` with a fresh-enough session, refreshing
if the cached credentials are missing or expired.

# `invalidate`

Marks the session as invalid so the next `credentials/0` call re-authenticates.
Called after a 401 or auth-error response.

# `start_link`

Starts the session GenServer. Started under the package's supervisor at
app boot; not typically called directly.

---

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