question

ChristianPuhr-5733 avatar image
0 Votes"
ChristianPuhr-5733 asked azure-cxp-api edited

Prompt O365 Authentication for Acess to SharePoint Lists through App

Hello all!

I have developed a VB.NET app which reads/writes data from/to SharePoint Online lists. My organization uses the Office 365 two-factor authentication with Autheticator app. Now, it is possible to add my login credentials to the code allowing me to access the lists. However, this is not a good solution as other users of my app always use my login data.

Is there a way to trigger the normal O365 authentication (e.g. through opening a web browser window)? Like Teams, Skype or Outlook do? That way the access could work on a per-user basis.

Thank you for your response!

Best regards,

Christian

office-sharepoint-online
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AmosWu-MSFT avatar image
0 Votes"
AmosWu-MSFT answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ChristianPuhr-5733 avatar image
0 Votes"
ChristianPuhr-5733 answered AmosWu-MSFT commented

Hello!

Thank you! I do not seem to have that installed and might not be able to get it in my corporate environment.

Maybe there is another way.

Best regards,

Christian

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Or you could try to use App permission, Accessing SharePoint using an application context, also known as app-only
This method also requires you to install the OfficeDevPnP.Core package. Apart from this, there should be no other way.

0 Votes 0 ·