Skip to content

Commit

Permalink
show login uri in the terminal before opening the browser so that use…
Browse files Browse the repository at this point in the history
…r could use it elsewhere

fixes #1825
  • Loading branch information
lostmsu committed Feb 7, 2025
1 parent b62021f commit a09fd8e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/shared/Core/Authentication/OAuth/OAuth2Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public IOAuth2CodeGenerator CodeGenerator
set => _codeGenerator = value;
}

public Uri RedirectUri => _redirectUri;

#region IOAuth2Client

public async Task<OAuth2AuthorizationCodeResult> GetAuthorizationCodeAsync(IEnumerable<string> scopes,
Expand Down
1 change: 1 addition & 0 deletions src/shared/GitHub/GitHubAuthentication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ public async Task<OAuth2TokenResult> GetOAuthTokenViaBrowserAsync(Uri targetUri,

// Write message to the terminal (if any is attached) for some feedback that we're waiting for a web response
Context.Terminal.WriteLine("info: please complete authentication in your browser...");
Context.Terminal.WriteLine($"uri: {oauthClient.RedirectUri}");

OAuth2AuthorizationCodeResult authCodeResult =
await oauthClient.GetAuthorizationCodeAsync(scopes, browser, queryParams, CancellationToken.None);
Expand Down
1 change: 1 addition & 0 deletions src/shared/GitLab/GitLabAuthentication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ public async Task<OAuth2TokenResult> GetOAuthTokenViaBrowserAsync(Uri targetUri,

// Write message to the terminal (if any is attached) for some feedback that we're waiting for a web response
Context.Terminal.WriteLine("info: please complete authentication in your browser...");
Context.Terminal.WriteLine($"uri: {oauthClient.RedirectUri}");

OAuth2AuthorizationCodeResult authCodeResult =
await oauthClient.GetAuthorizationCodeAsync(scopes, browser, CancellationToken.None);
Expand Down

0 comments on commit a09fd8e

Please sign in to comment.