MFA Hanlding in CSOM

sp13test 281 Reputation points

Currently, we enabled the MFA For the user and then the CSOM code with SharePointOnlineCredentials is not working.

Is there any workaround to fix the issue for MFA ?

Thanks for any help.

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,591 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jerryzy 10,566 Reputation points

    Hi @sp13test ,

    Agree with trevorseward's suggestion, please register a SharePoint App in /_layouts/15/AppRegNew.aspx and use Client ID/Secret for authentication:

    Connect To SharePoint Online Site With App Only Authentication

    Best Regards

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Trevor Seward 11,691 Reputation points

    Use Client ID + Certificate or Secret instead of username and password.

    0 comments No comments