Skip to content

Commit a09fd8e

Browse files
committed
show login uri in the terminal before opening the browser so that user could use it elsewhere
fixes git-ecosystem#1825
1 parent b62021f commit a09fd8e

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

src/shared/Core/Authentication/OAuth/OAuth2Client.cs

+2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ public IOAuth2CodeGenerator CodeGenerator
9999
set => _codeGenerator = value;
100100
}
101101

102+
public Uri RedirectUri => _redirectUri;
103+
102104
#region IOAuth2Client
103105

104106
public async Task<OAuth2AuthorizationCodeResult> GetAuthorizationCodeAsync(IEnumerable<string> scopes,

src/shared/GitHub/GitHubAuthentication.cs

+1
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ public async Task<OAuth2TokenResult> GetOAuthTokenViaBrowserAsync(Uri targetUri,
437437

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

441442
OAuth2AuthorizationCodeResult authCodeResult =
442443
await oauthClient.GetAuthorizationCodeAsync(scopes, browser, queryParams, CancellationToken.None);

src/shared/GitLab/GitLabAuthentication.cs

+1
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ public async Task<OAuth2TokenResult> GetOAuthTokenViaBrowserAsync(Uri targetUri,
278278

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

282283
OAuth2AuthorizationCodeResult authCodeResult =
283284
await oauthClient.GetAuthorizationCodeAsync(scopes, browser, CancellationToken.None);

0 commit comments

Comments
 (0)