Use MFA tokens for programmatic authentication in Sharepoint online

Suresh S 1 Reputation point

Hi All,

In order to do the programmatic authentication in SharePoint Online, Can we use the MFA token in program for the authentication till the token expire?

We have an account in O365 and enabled MFA for the user account and the same user account is used for programmatic authentication. We want to avoid the every time second level authentication in mobile. We are looking for the feasibility to use the old MFA token.

MFA Token : Which we are getting in the registered mobile number during the SharePoint Online authentication.

Please let me know feasibility of this request.

Thanks & Regards
Suresh S

A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,153 questions
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,557 questions
SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,761 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. RaytheonXie_MSFT 29,041 Reputation points Microsoft Vendor

    Hi @Suresh S ,
    We are unable to skip the second level authentication in mobile. I would recommend you SharePoint App-Only to do the programmatic authentication in SharePoint Online.
    Please refer to the following document:

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    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.

  2. sadomovalex 3,621 Reputation points

    token which you got from MFA-authenticated user will expire quite soon so you won't be able to use it for a long time. It is better to register AAD app, grant necessary permissions for this app, generate app secret or upload self-signed certificate to this app and use app permissions (=use token generated for this app).

    0 comments No comments