Jose Carrillo

Jose Carrillo

  • NA
  • 13
  • 6.6k

How to do Multi-factor auth with SharePoint-Online CSOM

Feb 3 2020 4:11 AM

Using just a password-based authentication, it's easy to authenticate in CSOM from my C# application:

context.Credentials = new SharePointOnlineCredentials(username, password);
But how to authenticate when Multi-factor authentication (MFA) is activated?
 
Since the MFA was activated in the tenant, i get the error: 
 
The sign-in name or password does not match one in the Microsoft account system
Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.GetServiceToken
 
Is there any way?
 
I´ve read about using APP PAssword, but the new password created  doesn´t work from C# code
 
Thanks.

Answers (2)