# `KeenAuth.Plug`
[🔗](https://github.com/KeenMate/keen_auth/blob/main/lib/plug.ex#L1)

Main plug that stores KeenAuth configuration in the connection.

This plug must be included in your pipeline before any KeenAuth functionality
can be used. It stores the configuration in the connection's private data,
making it accessible to controllers and other plugs.

## Usage

Add the plug to your router pipeline:

    pipeline :authentication do
      plug KeenAuth.Plug, otp_app: :my_app
    end

    scope "/auth" do
      pipe_through [:browser, :authentication]
      KeenAuth.authentication_routes()
    end

## Configuration

The plug accepts any configuration options that will be merged with your
application's `:keen_auth` configuration. Common options:

- `:otp_app` - The OTP application name where configuration is stored
- `:strategies` - List of authentication strategies (usually in app config)
- `:storage` - Custom storage module (defaults to session storage)

# `call`

# `fetch_config`

```elixir
@spec fetch_config(Plug.Conn.t()) :: KeenAuth.Config.t()
```

Fetch configuration from the private key in the connection.

It'll raise an error if configuration hasn't been set as a private key.

# `init`

# `put_config`

```elixir
@spec put_config(Plug.Conn.t(), KeenAuth.Config.t()) :: Plug.Conn.t()
```

Put the provided config as a private key in the connection.

---

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