Implement loopback OAuth flow for GitHub login in Avalonia#4916
Merged
Gabriel Dufresne (GabrielDuf) merged 2 commits intoJun 12, 2026
Conversation
Marc-André Moreau (mamoreau-devolutions)
approved these changes
Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request implements a new OAuth login flow for GitHub authentication in the Avalonia app, switching from the device flow to a local loopback HTTP server that captures the OAuth redirect and authorization code. It also adds support for securely providing the GitHub client secret, improves error handling, and updates the secrets generation scripts to handle the new secret. The most important changes are:
GitHub OAuth Login Flow
GHAuthApiRunnerclass which implements a lightweight loopback HTTP server usingTcpListenerto capture the GitHub OAuth redirect and extract the authorization code, removing the dependency on ASP.NET Core for Avalonia. (src/UniGetUI.Avalonia/Infrastructure/GHAuthApiRunner.cs)GitHubAuthServiceto use the new OAuth code flow via the loopback server, including event handling for login and cancellation, and a timeout for the login process. The device flow code and related events were removed. (src/UniGetUI.Avalonia/Infrastructure/GitHubAuthService.cs)Secrets Handling
generate-secrets.ps1andgenerate-secrets.sh) and theSecretsclass to support aGetGitHubClientSecret()method, allowing the client secret to be securely injected at build time. (src/UniGetUI.Avalonia/Infrastructure/generate-secrets.ps1,src/UniGetUI.Avalonia/Infrastructure/generate-secrets.sh,src/UniGetUI.Avalonia/Infrastructure/Secrets.cs)Error Handling and User Feedback
src/UniGetUI.Avalonia/Infrastructure/GHAuthApiRunner.cs,src/UniGetUI/Pages/SettingsPages/GeneralPages/Backup.xaml.cs)WinUI Service Parity
src/UniGetUI/Services/BackgroundLoginApi.cs,src/UniGetUI/Services/GitHubAuthService.cs)Project File Update
GHAuthApiRunner.csin the Avalonia project file so it is included in the build. (src/UniGetUI.Avalonia/UniGetUI.Avalonia.csproj)