Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Use DefaultNetworkCredentials if the current credentials should be used #2076

Merged
merged 1 commit into from
Jul 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Commands/Base/SPOnlineConnectionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,12 @@ internal static SPOnlineConnection InstantiateSPOnlineConnection(Uri url, PSCred
{
context.Credentials = new NetworkCredential(credentials.UserName, credentials.Password);
}
else
{
// If current credentials should be used, use the DefaultNetworkCredentials of the CredentialCache. This has the same effect
// as using "UseDefaultCredentials" in a HttpClient.
context.Credentials = CredentialCache.DefaultNetworkCredentials;
}
}
#if SP2013 || SP2016 || SP2019
var connectionType = ConnectionType.OnPrem;
Expand Down