[Personal-WP] Add GitHub OAuth integration for private repositories #3180
+2,829
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation for the change, related issues
This PR adds GitHub OAuth support to personal-wp, allowing blueprints to access private GitHub repositories. This mirrors the existing OAuth support in the main website.
Todo after merging
Create a new Github app and configure the
CLIENT_IDandCLIENT_SECRETfor this deployment.Contains fixes from #3181
Implementation details
OAuth Flow
oauth.phpfor token exchange with GitHubGitHubPrivateRepoAuthModalcomponent to prompt for authentication when a blueprint requires private repo accesscreateGitAuthHeaders()provides authentication headers for GitHub API requestsBlueprint Preservation
blueprint-urlquery parameters early inmain.tsxto survive the OAuth redirect flowbuildOAuthRedirectUrl()also handles this conversion when building the redirect URLMulti-tab Handling
sessionStorage(not just memory) to survive the takeover reload. sessionStorage is cleared when the tab closes, maintaining security.Error Handling
GitAuthenticationErrorin the boot error handlerblueprint-urlbefore OAuth redirect could preserve it)Testing Instructions (or ideally a Blueprint)
oauth.phpconfigured for your GitHub OAuth appMulti-tab test: