Try to use the GetWebLoginClientContext
method in OfficeDevPnP.Core.AuthenticationManager
. When we use this method, it opens a pop-up with the standard tenant login page, and users will be prompted for the credentials and challenges for the second-factor authentication.
Refer to this blog for details:Sharepoint: Connect to site with MFA enabled using CSOM and PnP PowerShell
If the response 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.