The process of building custom applications and tools that interact with Microsoft SharePoint, including SharePoint Online in Microsoft 365.
Is your account by chance enforced for per-user MFA? I run into a similar issue and had to reset the per-user MFA status, details are here: https://www.michev.info/blog/post/6242/the-strange-case-of-a-login-loop-caused-by-phantom-proofup-requirements