we have noticed that our SharePoint AddIn cannot get permissions on a newly created trial O365 tenant.
While getting the ClientContext with ClientID and ClientSecret we get this error "The remote server returned an error: (401) Unauthorized."
We have tried to register a new app-only principal to test if it works on a new tenant by following this documentation from Microsoft:
After registering and trying again, on the new tenant we got the exact same error "The remote server returned an error: (401) Unauthorized."
But when we tried on an older tenant that we had, it worked fine for both our SharePoint Add-In and for a newly registered principal.
Very simple call using OfficeDevPnP nuget.
OfficeDevPnP.Core.AuthenticationManager am = new OfficeDevPnP.Core.AuthenticationManager();
using (Microsoft.SharePoint.Client.ClientContext context = am.GetAppOnlyAuthenticatedContext(createEntity.AppUrl, clientId, clientSecret))
Web web = context.Web;
context.Load(web, w => w.Id, w => w.Title);
Is anyone else having the same issue on fresh newly created O365 tenants?
Or maybe there is some new setting to allow using "SharePoint App-Only" authentication?
I have posted the same question to another forum, but was redirected to post here also.