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

Commit

Permalink
Merge pull request #2797 from KoenZomers/MakeUseWebLoginFaster
Browse files Browse the repository at this point in the history
Optimizing login speed with Connect-PnPOnline -UseWebLogin
  • Loading branch information
erwinvanhunen authored Sep 6, 2020
2 parents c809888 + 64cbe6d commit 6f82efe
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Commands/Base/PnPConnectionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,16 @@ internal static PnPConnection InstantiateWebloginConnection(Uri url, int minimal
{
using (var authManager = new OfficeDevPnP.Core.AuthenticationManager())
{
var context = PnPClientContext.ConvertFrom(authManager.GetWebLoginClientContext(url.ToString()), retryCount, retryWait * 1000);
// Log in to a specific page on the tenant which is known to be performant
var webLoginClientContext = authManager.GetWebLoginClientContext(url.ToString(), loginRequestUri: new Uri(url, "/_layouts/15/settings.aspx"));

// Ensure the login process has been completed
if(webLoginClientContext == null)
{
return null;
}

var context = PnPClientContext.ConvertFrom(webLoginClientContext, retryCount, retryWait * 1000);

if (context != null)
{
Expand Down

0 comments on commit 6f82efe

Please sign in to comment.