# `PhoenixKit.Install.OAuthConfig`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.164/lib/phoenix_kit/install/oauth_config.ex#L1)

Handles OAuth configuration for PhoenixKit installation.

PhoenixKit uses **fully dynamic OAuth** - providers are configured at runtime from database.
However, a minimal compile-time configuration is still required for Ueberauth to initialize.

## How It Works

Instead of using `plug Ueberauth` (which requires compile-time providers configuration),
PhoenixKit calls Ueberauth functions directly in the OAuth controller:

```elixir
# In PhoenixKitWeb.Users.OAuth controller:
# - request/2 calls Ueberauth.run_request/4
# - callback/2 calls Ueberauth.run_callback/4
```

This approach allows:
- **Minimal compile-time configuration** - Only `config :ueberauth, Ueberauth, providers: %{}`
- **Database-driven credentials** - Credentials loaded from Settings table at runtime
- **Dynamic provider management** - Add/remove/modify providers without app restart

## Runtime OAuth Flow

1. User clicks "Sign in with Google"
2. `PhoenixKitWeb.Plugs.EnsureOAuthConfig` loads credentials from database
3. `PhoenixKitWeb.Users.OAuth.request/2` calls `Ueberauth.run_request/4` dynamically
4. User authenticates with provider
5. `PhoenixKitWeb.Users.OAuth.callback/2` calls `Ueberauth.run_callback/4` dynamically
6. User is logged in

## Related Modules

- `PhoenixKit.Users.OAuthConfig` - Configures credentials in Application env at runtime
- `PhoenixKit.Workers.OAuthConfigLoader` - Loads OAuth config on app startup
- `PhoenixKitWeb.Plugs.EnsureOAuthConfig` - Ensures credentials loaded before OAuth
- `PhoenixKitWeb.Users.OAuth` - OAuth controller with dynamic Ueberauth calls

# `add_oauth_configuration`

Adds OAuth configuration for PhoenixKit installation.

This adds the minimal Ueberauth configuration required for compilation.
OAuth providers are configured dynamically at runtime from the database.

## Parameters
- `igniter` - The igniter context

## Returns
Updated igniter with Ueberauth configuration and informational notice.

## Example
```elixir
igniter
|> OAuthConfig.add_oauth_configuration()
```

---

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