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:
# In PhoenixKitWeb.Users.OAuth controller:
# - request/2 calls Ueberauth.run_request/4
# - callback/2 calls Ueberauth.run_callback/4This 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
- User clicks "Sign in with Google"
PhoenixKitWeb.Plugs.EnsureOAuthConfigloads credentials from databasePhoenixKitWeb.Users.OAuth.request/2callsUeberauth.run_request/4dynamically- User authenticates with provider
PhoenixKitWeb.Users.OAuth.callback/2callsUeberauth.run_callback/4dynamically- User is logged in
Related Modules
PhoenixKit.Users.OAuthConfig- Configures credentials in Application env at runtimePhoenixKit.Workers.OAuthConfigLoader- Loads OAuth config on app startupPhoenixKitWeb.Plugs.EnsureOAuthConfig- Ensures credentials loaded before OAuthPhoenixKitWeb.Users.OAuth- OAuth controller with dynamic Ueberauth calls
Summary
Functions
Adds OAuth configuration for PhoenixKit installation.
Functions
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
igniter
|> OAuthConfig.add_oauth_configuration()