# `PhoenixKit.Workers.OAuthConfigLoader`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.164/lib/phoenix_kit/workers/oauth_config_loader.ex#L1)

GenServer worker that ensures OAuth configuration is loaded from database
before any OAuth requests are processed.

This worker runs synchronously during application startup to configure
OAuth providers from database settings.

## Startup Sequence

1. PhoenixKit.Cache starts with sync_init, loading critical OAuth settings
2. OAuthConfigLoader starts, OAuth settings already in cache
3. Loads OAuth configuration from cache
4. Configures Ueberauth with available providers
5. Returns :ok when complete

## Why This Is Needed

Parent applications typically start services in this order:
- Repo (database ready)
- PubSub
- Parent Endpoint (router compiles, Ueberauth.init() runs)
- PhoenixKit.Supervisor (OAuth config should load here)

With sync_init enabled in the Cache, critical OAuth settings are loaded
synchronously before this worker starts, eliminating race conditions.

This worker ensures OAuth configuration is available as early as possible
during PhoenixKit.Supervisor initialization.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `get_status`

Gets the current status of OAuth configuration.

Returns:
- `{:ok, :loaded}` - Configuration successfully loaded
- `{:ok, :not_loaded, reason}` - Configuration not loaded with reason
- `{:error, :not_running}` - OAuthConfigLoader is not running

# `reload_config`

Attempts to reload OAuth configuration.

This can be called to retry loading configuration if it failed during startup.

# `start_link`

Starts the OAuth configuration loader.

Loads OAuth configuration from cache which is pre-warmed with critical settings.

---

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