Forum Discussion
Authenticating to SharePoint Online site using CSOM
- Aug 02, 2017
I've seen this error more than once. In most cases I just typed username / password wrong. Federated authentication should not be a problem but have you considered using App Credentials also? Are you using Multi-factor authentication?
PnP's AuthenticationManager Class provides some usefull utility methods to obtain an authenticated context in different ways. Could you try using GetWebLoginClientContext for getting an authenticated context?
https://github.com/SharePoint/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/AuthenticationManager.cs
I've seen this error more than once. In most cases I just typed username / password wrong. Federated authentication should not be a problem but have you considered using App Credentials also? Are you using Multi-factor authentication?
PnP's AuthenticationManager Class provides some usefull utility methods to obtain an authenticated context in different ways. Could you try using GetWebLoginClientContext for getting an authenticated context?
https://github.com/SharePoint/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/AuthenticationManager.cs
- Chris StewartAug 02, 2017Brass Contributor
It looks like we are facing a similar issue, but have asked in different parts of the forum. https://techcommunity.microsoft.com/t5/SharePoint/Using-SharePoint-Client-Side-Object-Model-with-PowerShell-and/m-p/92734#M8667
I'll let know if I find anything.- Vijaya VellabatiAug 03, 2017Copper Contributor
Thanks Chris, i am glad that i am not the only one with this issue.
- Chris StewartAug 03, 2017Brass ContributorPaul's solution on the other thread works for me!
Paul Paschareplied to Chris Stewartyesterday - last edited yesterday
SolutionConnecting to SharePoint Online using PnP PowerShell Connect-PnPOnline allows you to specify a UseWebLogin parameter. This allows you to connect with MFA enabled. Once connected you'd have many more https://github.com/SharePoint/PnP-PowerShell/blob/master/Documentation/readme.mdat your disposal
https://github.com/SharePoint/PnP-PowerShell
Hope this helps!