Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do Multi-factor authentication with SharePoint-Online using CSOM

Using just a password-based authentication, it's easy to authenticate in CSOM:

context.Credentials = new SharePointOnlineCredentials(username, password);

But how to authenticate when Multi-factor authentication is in place (http://technet.microsoft.com/en-us/library/dn249471.aspx)?

like image 771
Edwin Avatar asked Nov 01 '22 16:11

Edwin


1 Answers

Use an app password in place of your normal one.

Generate an app password here:

https://account.activedirectory.windowsazure.com/AppPasswords.aspx

Or go to

https://portal.office.com/account/#security

and click Additional Security Verification > Create app password.

You can always revoke/delete the app password later.

like image 113
Dunc Avatar answered Nov 15 '22 12:11

Dunc