Access SharePoint Online with AzureAD APP authentication from .Net core 3.1 Console application

Károlyi Zoltán 26 Reputation points

Hi Masters,

In a new solution we need to access SharePoint Online Site with CSOM. The application is .net Core 3.1 based, and we have to user AzureAD to access SharePoint. So I have created an App (App Registration) in Azure, created a Client Secret, and get AccessToken from AAD.

But SharePoint Online sends 401 back.

Using ClientCertificate to get AccessToken the connection is working.

Is there a way to use ClientSecret to access SharePoint?


A set of technologies in the .NET Framework for building web applications and XML web services.
4,281 questions
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,995 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,076 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jerryzy 10,566 Reputation points

    Hi @KrolyiZoltn-0660 ,

    Currently, Azure AD App Client Secret authentication option is blocked by SharePoint Online, so it's not available to use Client Secret, it's necessary to use Certificate instead:


    Please check the official documetation for detailed information:

    Granting access via Azure AD App-Only

    And here is a demo to get acess token with Azure AD App Certificate in CSOM, I suggest that you can refer :

    Calling SharePoint Online APIs using Azure AD App-Only permissions and certificate auth

    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.

    0 comments No comments

0 additional answers

Sort by: Most helpful