Same problem here with signing into M365 for MS-Office activation and also signing into M365 email from Outlook. The "Just a moment ..." message always builds 3 times, stopping on the second fresh. Can sign into user's account on web-based office.com, but not in MS-Office. Solved this mostly by installling an older version of MS-Office; however, OneDrive still gives the recurring "Just a moment ..." message, which always refreshes twice, and goes nowhere on the third refresh of this message. Account can sign into web-based M365 Outlook with no error.
Computer did initially have wrong time zone. Correcting this did not fixed the recurring "Just a moment ...".
Spent all night trying to get this working. Computer is now deployed -- couldn't wait -- with an outdated (and unsupported) MS-Office version and no shared files in OneDrive. Might be nice if there were a solution for this.