# `PhoenixKit.Users.OAuthAvailability`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.165/lib/phoenix_kit/users/oauth_availability.ex#L1)

Checks OAuth availability and configured providers.

This module provides runtime checks to determine if OAuth dependencies are loaded
and which providers are properly configured. It enables graceful degradation when
OAuth dependencies are not installed.

# `configured_providers`

```elixir
@spec configured_providers() :: [atom()]
```

Gets list of configured OAuth providers.

Returns a list of provider names (as atoms) that have both:
- Credentials configured in the database
- Provider enabled in settings

Returns an empty list if Ueberauth is not loaded or no providers are properly configured.

## Examples

    iex> PhoenixKit.Users.OAuthAvailability.configured_providers()
    [:google, :apple]

    iex> PhoenixKit.Users.OAuthAvailability.configured_providers()
    []

# `oauth_available?`

```elixir
@spec oauth_available?() :: boolean()
```

Checks if OAuth is available (enabled in settings, Ueberauth loaded, and at least one provider configured).

## Examples

    iex> PhoenixKit.Users.OAuthAvailability.oauth_available?()
    true

    iex> PhoenixKit.Users.OAuthAvailability.oauth_available?()
    false

# `oauth_enabled_in_settings?`

```elixir
@spec oauth_enabled_in_settings?() :: boolean()
```

Checks if OAuth is enabled in settings.

Returns `true` if OAuth is explicitly enabled in settings, defaults to `false`.

## Examples

    iex> PhoenixKit.Users.OAuthAvailability.oauth_enabled_in_settings?()
    true

# `provider_configured?`

```elixir
@spec provider_configured?(atom() | String.t()) :: boolean()
```

Checks if a specific provider is configured.

A provider is considered configured if:
- It's enabled in settings
- It has valid credentials in the database
- Ueberauth is loaded

## Examples

    iex> PhoenixKit.Users.OAuthAvailability.provider_configured?(:google)
    true

    iex> PhoenixKit.Users.OAuthAvailability.provider_configured?(:github)
    false

# `provider_enabled?`

```elixir
@spec provider_enabled?(atom()) :: boolean()
```

Checks if a specific OAuth provider is enabled in settings.

Returns `true` if both the master OAuth switch and the individual provider are enabled.
Requires the master `oauth_enabled` setting to be true.

## Examples

    iex> PhoenixKit.Users.OAuthAvailability.provider_enabled?(:google)
    true

    iex> PhoenixKit.Users.OAuthAvailability.provider_enabled?(:apple)
    false

# `status`

```elixir
@spec status() :: map()
```

Gets OAuth status information for debugging and admin interfaces.

## Examples

    iex> PhoenixKit.Users.OAuthAvailability.status()
    %{
      enabled_in_settings: true,
      ueberauth_loaded: true,
      providers: [:google, :apple],
      available: true
    }

# `ueberauth_loaded?`

```elixir
@spec ueberauth_loaded?() :: boolean()
```

Checks if Ueberauth library is loaded and available.

Returns `true` if the Ueberauth module is available, `false` otherwise.

## Examples

    iex> PhoenixKit.Users.OAuthAvailability.ueberauth_loaded?()
    true

    iex> PhoenixKit.Users.OAuthAvailability.ueberauth_loaded?()
    false

---

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