Hi justin-jia,
App Password can't be used in .NET Core solution (.NET Framework solution works).
A workaround is to use Azure AD App-Only credential with PnP.Framework library, here is a blog with the configuration steps and code demo for your reference:
Calling SharePoint Online APIs using Azure AD App-Only permissions and certificate auth
Here are some points to note:
- It's necessary to create certificate for Azure AD App for authentication, ClientSecret method has been blocked by SharePoint Online currently.
- Before installing PnP.Framework, please install PnP.Core with this command firstly:
Install-Package PnP.Core -Version 0.6.6-beta3 Then install PnP.Framework: Install-Package PnP.Framework -Version 1.2.0
- The old SharePointPnPCoreOnline is archived and not complicate with .NET Core solution, so please don't use it for MFA Authentication.
Here is the test result capture in .NET Core solution:
Thanks
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.