Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.

Commit 90e17ea

Browse files
author
J Wyman
authored
Merge pull request #645 from whoisj/fix-ghauth
github: conditionally append OTP header
2 parents 1420d21 + f7a726a commit 90e17ea

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

GitHub.Authentication/Src/Authority.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ public async Task<AuthenticationResult> AcquireToken(
8686
};
8787

8888
options.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(GitHubApiAcceptsHeaderValue));
89-
options.Headers.Add(GitHubOptHeader, authenticationCode);
89+
90+
if (!string.IsNullOrWhiteSpace(authenticationCode))
91+
{
92+
options.Headers.Add(GitHubOptHeader, authenticationCode);
93+
}
9094

9195
// Create the authority Uri.
9296
var requestUri = targetUri.CreateWith(_authorityUrl);

0 commit comments

Comments
 (0)