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.