No longer able to use OfficeDevPnP.Core.AuthenticationManager OR PnP.Framework.AuthenticationManager().GetACSAppOnlyContext

john john 916 Reputation points

I usually run those command inside my CSOM code to authenticate to Office 365 using ClientId + ClientSecret:-

using (ClientContext context2 = new PnP.Framework.AuthenticationManager().GetACSAppOnlyContext(siteUrl, clientId, clientSecret, AzureEnvironment.Production))


using (ClientContext context3 = new OfficeDevPnP.Core.AuthenticationManager().GetAppOnlyAuthenticatedContext(siteUrl, clientId, clientSecret, AzureEnvironment.Production))

But starting from yesterday the above commands are raising these errors:-

Unhandled Exception: Microsoft.IdentityModel.SecurityTokenService.RequestFailedException: Token request failed. ---> System.Net.WebException: The remote server

any advice? i checked the expiry date for the app and it is still valid till july 2021..

A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,172 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. MichaelHan-MSFT 18,001 Reputation points

    Hi @john john ,

    Could it be that the SharePoint app-only permissions is disabled for you tenant? You could check it with this command: get-spotenant | select DisableCustomAppAuthentication

    And you could run the below cmdlet to enable it: Set-SPOTenant -DisableCustomAppAuthentication $false

    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.

  2. MichaelHan-MSFT 18,001 Reputation points
    0 comments No comments