I'm trying to authenticate to Sharepoint site i've made (it has a list with 2 items in it),
i need to print its title to the console - really simple approach.
with OfficeDevPnp.Core Nuget installed i tried the AppOnly following code:

public static void AppOnlyAuthCall()
        {
            using (var clientContext = new AuthenticationManager().GetAppOnlyAuthenticatedContext(siteUrl, clientId, clientSecret))
            {
                clientContext.Load(clientContext.Web, page => page.Title);
                clientContext.ExecuteQuery();
                Console.WriteLine(clientContext.Web.Title);
            };
        }

and it gives me an error:
Microsoft.IdentityModel.SecurityTokenService.RequestFailedException: 'Token request failed.'
WebException: The remote server returned an error: (401) Unauthorized.

Even though i did create API Permissions to sharepoint (read with no admin consent required),
giving permission through "appregnew.aspx"
what am i missing?

If anyone could refer me to an UP TO DATE and Actually Working guide on how to authenticate to sharepoint programmatically (C#) it'll be awesome

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.