Hi,
I ran into a similar problem when I was using a shared email address without a license in Office 365 with woocommerce.
What I found out was if I created the API credentials with a user with a valid license that was included in the shared mailbox it resolved the issue.
You have to delete the old one in Azure Active Directory -> App Registrations -> Web Apps profile in the unlicensed account, logout. Then login with a user and recreate it in the account with permissions.
Hope this helps,
Dan