Fix OAuth buttons generating incorrect URLs with locale prefix - #198
Conversation
OAuth routes are defined without locale prefix, but Routes.path() was adding locale by default, causing URLs like /phoenix_kit/en/users/auth/google instead of /phoenix_kit/users/auth/google. This made blog catch-all routes intercept OAuth requests, returning 404. Added locale: :none option to all OAuth button links.
…onditions When OAuth settings are updated in the admin panel and providers are reconfigured, the cache may not be invalidated yet. This caused OAuth configuration to use stale credentials from cache. Added get_oauth_credentials_direct/1, has_oauth_credentials_direct?/1, and get_settings_direct/1 functions that bypass cache for security-critical operations. OAuthConfig now uses these direct reads when configuring providers after settings updates.
Additional Commit: Add direct database reads for OAuth credentialsThis commit fixes a race condition where OAuth configuration used stale cached credentials after settings update. ChangesSettings Module (
OAuth Config Module (
Why this is neededWhen OAuth settings are updated in the admin panel and providers are reconfigured, the cache may not be invalidated yet. This caused OAuth configuration to read stale credentials from cache, making the new settings appear to not work. Cache is still used for non-critical operations (UI display, availability checks in templates). |
Extended direct database reads for OAuth credentials to all remaining modules that check credentials availability: - OAuthAvailability.available_providers/0 now uses has_oauth_credentials_direct?/1 - OAuthConfigLoader now uses has_oauth_credentials_direct?/1 for provider checks - warm_critical_cache/0 no longer caches OAuth credentials (they use direct reads) This ensures consistent behavior across all OAuth-related code paths and prevents race conditions when credentials are updated through admin UI.
Additional Commit: Use direct DB reads for OAuth credentials throughout the codebaseExtended direct database reads for OAuth credentials to all remaining modules: ChangesOAuthAvailability (
OAuthConfigLoader (
Settings (
This ensures consistent behavior across all OAuth-related code paths. |
Summary
/phoenix_kit/en/users/auth/google)Changes
locale: :noneoption to all OAuth button links inoauth_buttons.exTest Plan