MFA Enabled User account not working in CSOM

g h 716 Reputation points
2020-08-12T02:08:23.967+00:00

When trying an account that has Multi-Factor Authentication enabled, it's throwing error like this:

17045-snipaste-2020-08-12-10-03-41.png

Is there any way to resolve this issue ?

SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,604 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jerryzy 10,571 Reputation points
    2020-08-12T07:42:00.287+00:00

    Hi @g h ,

    You can create a app password in the link below:

    AppPasswords.aspx

    Then you can connect to site using AppPassword like this:

    17201-snipaste-2020-08-12-15-41-31.png

    Or you can use SharePointPnPCoreOnline assembly, this will pop up a login dialogue and make it available to use MFA Authentication:

    Reference:

    Using CSOM To Connect To A SharePoint Site With Multi Factor Authentication Enabled

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Trevor Seward 11,701 Reputation points
    2020-08-12T15:37:11.54+00:00

    Don't use App Passwords! That bypasses MFA. App Passwords should be disabled on your tenant.

    Instead, use the Client ID/Secret model by registering your addin with SharePoint and granting it the proper permissions.

    https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/add-in-permissions-in-sharepoint

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.