Forum Discussion
KenStewart
Aug 01, 2019Copper Contributor
Connect-PnPOnline -UseWebLogin fails, login window disappears
I downloaded the latest version of PnP PowerShell today but have had no success with Connect-PnPOnline (no problem using Connect-SPOService). I get the dreaded error "For security reasons DTD is prohibited in this XML document." I've researched this and tried all the fixes, like disabling IPv6 and pointing to Google DNS servers. I've also tried Windows and Generic Credentials, but these don't avoid the online authentication and get the same error.
The most promising work-around appeared to be the -UseWebLogin option, but the window disappears. It's only up for a fraction of a second, which isn't long enough for me to read the single line of text there.
Can anyone solve the case of the missing -UseWebLogin window? This is an Office 365 E3 tenant.
- AnonymousAug 02, 2019Have you tried amending your hosts file?
18 Replies
Sort By
- AnonymousHave you tried amending your hosts file?
- cjvandykCopper Contributor
What is being described here where the -UseWebLogin option is used and the screen pops up for a quick flash and then disappears leaving you connected, all sounds suspiciously like you may have Integrated Windows Authentication in the mix. If IWA is configured, it'll jump in and auth for you hence the window closing quickly.
https://learn.microsoft.com/en-us/aspnet/web-api/overview/security/integrated-windows-authentication
- KenStewartCopper Contributor
You're a lifesaver, Deleted. I saw that fix from Paul Ryan online, but I neglected to try it. So in response to your post, I added this entry to my hosts file:
127.0.0.1 msoid.summitservices.us.com # fix PnP connect problem
where our domain is summitservices.us.com. I connected first time without an authentication dialog (since I'd already set up Windows Credentials). I ran a few other applets as a quick test, all successful.
You definitely solved my main problem, but I tried to connect again using -UseWebLogin with the same result: quickly disappearing window. The mystery remains.
- Matthew CarterIron Contributor
KenStewart did you ever get this working? I tried, I think, as you said, I turned IPV6 off, I set Google 8.8.8.8 and 8.8.4.4 as my DNS and I logged on to my VPN (I work 100% remote), and all are doing exactly what you are having, my prompt for -UseWebLogin
Connect-PnPOnline -Url $SiteURL -UseWebLogin
Below is a screenshot from a video I took of it. I tried to uninstall and install it again (PNP) as it happens on my user account and on another account that I tried (my admin account).
Just like you, the prompt comes up for a millisecond and then goes away. I have put in my HOSTS file
127.0.0.1 msoid.summitservices.us.com # fix PnP connect problem
and restarted as I tried right after putting that in. I am on a Windows 10 system and I am running PowerShell v5.x as Admin. I tried with PowerShell v7 as well. All the same.
PS C:\WINDOWS\system32> Get-PnPContext RetryCount : 10 Delay : 500 PropertyBag : {} Web : Microsoft.SharePoint.Client.Web Site : Microsoft.SharePoint.Client.Site RequestResources : Microsoft.SharePoint.Client.RequestResources FormDigestHandlingEnabled : True ServerVersion : Url : https://TENANTNAME-admin.sharepoint.com/ ApplicationName : SharePoint PnP PowerShell Library ClientTag : DisableReturnValueCache : True ValidateOnClient : True AuthenticationMode : Default FormsAuthenticationLoginInfo : Credentials : WebRequestExecutorFactory : Microsoft.SharePoint.Client.DefaultWebRequestExecutorFactory PendingRequest : Microsoft.SharePoint.Client.ClientRequest HasPendingRequest : True Tag : RequestTimeout : 180000 StaticObjects : {[SharePointPnP$Settings$ContextCloning, PnP.Framework.Utilities.Context.ClientContextSettings], [Microsoft$SharePoint$SPContext$Current, Microsoft.SharePoint.Client.RequestContext]} ServerSchemaVersion : ServerLibraryVersion : RequestSchemaVersion : 15.0.0.0 TraceCorrelationId : PS C:\WINDOWS\system32>