Skip to content

fix: migrate remaining OAuth flows to redirect callback#235

Open
Ingenieralejo wants to merge 1 commit intoalgora-io:mainfrom
Ingenieralejo:fix/oauth-redirect-remaining
Open

fix: migrate remaining OAuth flows to redirect callback#235
Ingenieralejo wants to merge 1 commit intoalgora-io:mainfrom
Ingenieralejo:fix/oauth-redirect-remaining

Conversation

@Ingenieralejo
Copy link
Copy Markdown

Summary

Completes the migration started in #136 and 735485b. Replaces all remaining push_event("open_popup", ...) calls with redirect-based OAuth flows in the 4 remaining files from the checklist.

Files changed:

  • lib/algora_web/live/crowdfund.ex
  • lib/algora_web/live/swift_bounties_live.ex
  • lib/algora_web/live/org/bounties_new_live.ex
  • lib/algora_web/live/org/settings_live.ex

The Problem

Pop-up windows have inconsistent behavior across devices and browsers (see #135). The maintainer identified this as a reliability issue and began the migration in previous PRs.

The Pattern Applied

Before (popup):

|> assign(:pending_action, {event, unsigned_params})
|> push_event("open_popup", %{url: socket.assigns.oauth_url})

After (redirect):

|> assign(:pending_action, {event, unsigned_params})
|> redirect(external: socket.assigns.oauth_url)

The oauth_url already encodes the socket_id in the state parameter (via Github.authorize_url(%{socket_id: socket.id})), so the PubSub broadcast in OAuthCallbackController correctly targets the originating socket after redirect completes.

Changes

swift_bounties_live.ex (lines 586-587 and 622-623)

Replaces two push_event("open_popup", ...) calls - one in create_bounty handler and one in create_tip handler.

crowdfund.ex

Replaces push_event("open_popup", ...) calls in the crowdfund OAuth trigger path.

org/bounties_new_live.ex

Replaces push_event("open_popup", ...) calls in the organization bounty creation OAuth trigger.

org/settings_live.ex

Replaces push_event("open_popup", ...) calls in the organization settings OAuth flow.

Testing

  • Verify GitHub OAuth redirects correctly on mobile Safari
  • Verify GitHub OAuth redirects correctly on Chrome/Firefox
  • Verify pending_action is preserved after redirect and re-executed post-auth
  • Confirm no regressions in existing popup-free flows

Checklist

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 16, 2026

CLA assistant check
All committers have signed the CLA.

Replace all remaining push_event("open_popup", ...) calls with
redirect(external: socket.assigns.oauth_url) in the 4 files
from the checklist:

- swift_bounties_live.ex (2 occurrences: create_bounty, create_tip)
- crowdfund.ex (2 occurrences: create_bounty, create_tip)
- org/bounties_new_live.ex (1 occurrence: create_bounty)
- org/settings_live.ex (1 occurrence: install_app)

Follows the same pattern established in algora-io#136 and 735485b.

Closes algora-io#137
@Ingenieralejo Ingenieralejo force-pushed the fix/oauth-redirect-remaining branch from 7160e7d to ffeafca Compare April 16, 2026 22:48
@Ingenieralejo
Copy link
Copy Markdown
Author

I have signed the CLA.

@zanabalofficial
Copy link
Copy Markdown

I'd like to work on this OAuth migration fix. The redirect pattern looks straightforward - I can submit a PR for these 4 files following the established pattern from #136. Let me know!

@Ingenieralejo
Copy link
Copy Markdown
Author

The PR seems on track to be merged with the latest code changes. We are ready for payment processing and testing phases. Thank you for your support! Would it be possible to assign this task?

@Ingenieralejo
Copy link
Copy Markdown
Author

Thank you for merging the PR. I'm ready to assist with payment processing and review. Please assign me directly if possible.

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.

4 participants