End-to-end process of building, validating, and distributing custom apps and add-ins across Microsoft 365 platforms
I think that you have made a mistake on creating the Service Principal account
The OBJECT_ID is the Object ID from the Overview page of the Enterprise Application node (Azure Portal) for the application registration. It is not the Object ID from the Overview of the App Registrations node. Using the incorrect Object ID will cause an authentication failure.
Ref article: https://www.flowable.com/blog/office-365-exchange-oauth2-imap-authentication