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

Commit fdfe2b4

Browse files
author
J Wyman
authored
Merge pull request #728 from whoisj/v1.16/fix-tokens
alm: allow tokens as basic authorization
2 parents 47e32db + 7e06a39 commit fdfe2b4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Microsoft.Alm.Authentication/Network.cs

+9
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,15 @@ private HttpClient GetHttpClient(TargetUri targetUri, HttpMessageHandler handler
454454
}
455455
break;
456456

457+
case TokenType.Personal:
458+
{
459+
var credentials = (Credential)token;
460+
461+
// Credentials are packed into the 'Authorization' header as a base64 encoded pair.
462+
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", credentials.ToBase64String());
463+
}
464+
break;
465+
457466
default:
458467
Trace.WriteLine("! unsupported token type, not appending an authentication header to the request.");
459468
break;

0 commit comments

Comments
 (0)