Forum Discussion

Pavel161's avatar
Pavel161
Copper Contributor
Oct 15, 2024

Connect Project Online (PWA) using CSOM (C#) with MFA

Hello community, I need to work with MS Project Online (PWA) over API, CRUD projects, CRUD tasks  and etc.

I can connect to Project with using CSOM as described here:

https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/using-csom-for-dotnet-standard?source=recommendations

And it works fine until MFA is enabled.

Once MFA is enabled in Azure, the connection fails:

"error": "interaction_required",
"error_description": "AADSTS50076:
Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access

 I'm searching proper and working way to pass 2-factor auth (as example it works fine with Schedule API from the box)

Package "SharePointPnPCoreOnline" that contains GetWebLoginClientContext method is deprecated (https://www.nuget.org/packages/SharePointPnPCoreOnline/3.28.2012)

Package "PnP.Framework" does not contain (I can't see) ability to pass 2-factor auth and retrieve token (https://www.nuget.org/packages/PnP.Framework/1.17.0) and returns same error as above.

Can anyone tell me how to pass 2-factor authentication using C#, CSOM to get ProjectContext worked?

Thank you

 

Resources