generally you would create a service account, that does not have interactive login permission. this account also would not have 2 factor authentication.
programmatic use of Sharepoint api and 2factor authentication
I have need to write an application that utilizes the Sharepoint api to retrieve data from a list on the sharepoint site.
I've done this before, but in my current environment, the Sharepoint site requires a login with 2factor authentication.
I don't see how I can do this in an automated fashion in my program. The program is meant to run as a scheduled task once a day, and will not have any operator interaction.
So how does a person utilize the sharepoint api in an environment that has 2 factor authentication?
My program will be written in C#.
3 answers
Sort by: Most helpful
-
-
P a u l 10,406 Reputation points
2021-09-09T18:28:41.787+00:00 This article explains how to setup "App Only" to achieve this. The process is slightly different depending on whether you're using SharepointOnline/Azure or whether you're using an on-premise Sharepoint server:
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly -
RaytheonXie_MSFT 31,681 Reputation points Microsoft Vendor
2021-09-10T02:00:23.683+00:00 Hi @Les Stockton ,
We can set up an app-only principal with tenant permissions to achieve this.Please refer to following steps
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azureacs
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.