We have an SP Online site that has been working fine until recently. Now, when we call the SP authentication manager to get a new client context, I am getting the error 'Object reference not set to an instance of an object'. It's not due to an issue with the client id or secret (we ruled that out by refreshing the client id/secret).
Any thoughts on what might be causing this? I have pasted below the code snippet for the call to get the CC, and the log entries showing the error.
C# code:
var am = new AuthenticationManager();
return am.GetAppOnlyAuthenticatedContext(siteUrl, realm, clientId, clientSecret);
Log entries:
2019-04-30 10:53:19,821 ERROR [NX5UIRGA] [SharePointWorker ] - Request faild System.NullReferenceException: Object reference not set to an instance of an object. at OfficeDevPnP.Core.Utilities.TokenHelper.GetAppOnlyAccessToken(String targetPrincipalName, String targetHost, String targetRealm) at OfficeDevPnP.Core.AuthenticationManager.EnsureToken(String siteUrl, String realm, String appId, String appSecret, String acsHostUrl, String globalEndPointPrefix)