We have a console application running every night which updates some project plans with CSOM. This uses the SharePointOnlineCredentials for authentication.

But the IT departments wants to change the flag of LegacyAuthProtocolsEnabled of the tenant to false. This has as consequence that SharePointOnlineCredentials can no longer be used as you can read [here](https://albandrodsmemory.wordpress.com/2018/04/25/error-connecting-to-sharepoint-online-with-powershell/).

A suggested approach in the link above was to use a ClientId and ClientSecret. I've tested this with the [PnP Core](https://github.com/SharePoint/PnP-Sites-Core) AutheticationManager function GetAppOnlyAuthenticatedContext. This works for a ClientContext object for SharePoint Online but it does not work after modifying this function to return a ProjectContext object. A ProjectServerError "GeneralNotLicensed" is thrown because the SharePoint Principal does not have a Project Online license (see [here](https://social.technet.microsoft.com/Forums/en-US/da81effc-a5e3-4e3a-b8f3-ee2ea35e016a/csom-generalnotlicensed-error?forum=projectonline)).

My third attempt was to use the Office365ClaimsHelper class found [here](https://github.com/tristian2/ADtoSharePointOnlineData/blob/master/DW.Profiles/DW.ClientOmAuth/Office365ClaimsHelper.cs). This contacts <https://login.microsoftonline.com/extSTS.srf> for a SAML token by providing the username and password. Now this approach works for a demo environment, but not for the production environment. I suspect because this has a Multi-Factor authentication.

To put things short: does anyone have an idea on how to get a ProjectContext object without using SharePointOnlineCredentials and without showing a pop-up to log in a user on a Multi-Factor authentication environment?