Skip to content

Fix critical OAuth bugs and bump version to 1.4.7#139

Merged
ddon merged 3 commits into
BeamLabEU:devfrom
timujinne:dev
Oct 29, 2025
Merged

Fix critical OAuth bugs and bump version to 1.4.7#139
ddon merged 3 commits into
BeamLabEU:devfrom
timujinne:dev

Conversation

@timujinne
Copy link
Copy Markdown
Contributor

Summary

Fixed two critical bugs preventing OAuth authentication with Google and other providers.

Changes

Critical Fixes

  • OAuth base_path preservation - Fixed Ueberauth base_path being lost during provider configuration
  • OAuth struct field access - Fixed UndefinedFunctionError when processing OAuth callbacks

Version Update

  • Bumped version from 1.4.6 to 1.4.7
  • Updated CHANGELOG.md with comprehensive documentation

Technical Details

Issue #1: base_path Preservation

File: lib/phoenix_kit/users/oauth_config.ex

  • configure_ueberauth_base/0 now preserves existing base_path from configuration
  • Added get_oauth_base_path/0 helper to automatically determine base path
  • Prevents "Ueberauth plugin did not process request" error

Issue #2: Struct Field Access

File: lib/phoenix_kit/users/oauth.ex

  • Replaced bracket notation (auth.credentials[:token]) with dot notation (auth.credentials.token)
  • Added safe get_raw_info/1 helper with pattern matching
  • Fixes "Ueberauth.Auth.Credentials does not implement Access behaviour" error

Impact

  • ✅ OAuth authentication now works correctly with Google, GitHub, Apple, and Facebook
  • ✅ Both bugs completely prevented OAuth from functioning
  • ✅ All existing OAuth configurations work without any changes required

Test Plan

  • All pre-commit checks passed (mix format, credo, dialyzer)
  • Code compiles without errors
  • No breaking changes to existing functionality
  • Changes tested in production environment (fixes verified)

Files Modified

  • lib/phoenix_kit/users/oauth_config.ex - base_path preservation
  • lib/phoenix_kit/users/oauth.ex - struct field access fixes
  • mix.exs - version bump to 1.4.7
  • CHANGELOG.md - comprehensive documentation

fix Refactoring opportunities  and  Code Readability
fix dialyzer warning
Issue #1: Preserve Ueberauth base_path during configuration
- Function configure_ueberauth_base/0 now preserves existing base_path
- Added get_oauth_base_path/0 helper to set default based on URL prefix
- Prevents "Ueberauth plugin did not process request" error

Issue #2: Fix struct field access using bracket notation
- Replaced auth.credentials[:token] with auth.credentials.token
- Replaced auth.credentials[:refresh_token] with auth.credentials.refresh_token
- Replaced auth.extra[:raw_info] with safe get_raw_info/1 helper
- Fixes UndefinedFunctionError when OAuth callback processes response

These changes eliminate critical bugs that completely prevented OAuth
authentication with Google and other providers. Both issues were
discovered during production testing with PhoenixKit v1.4.6.

Modified files:
- lib/phoenix_kit/users/oauth_config.ex
- lib/phoenix_kit/users/oauth.ex

All quality checks passed (mix format, credo, dialyzer, test)
Bumped version from 1.4.6 to 1.4.7

Added comprehensive changelog entry documenting:
- OAuth base_path preservation fix
- OAuth struct field access fix
- Impact assessment and upgrade notes

Both critical bugs prevented OAuth authentication from working
with Google, GitHub, Apple, and Facebook providers.
@ddon ddon merged commit 18f2ac4 into BeamLabEU:dev Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants