It was working with Basic authentication.
Herr is the way Zammand is going:
For shared mailboxes the needed method is:
S = Shared Mailbox name, e.g. shared@example.tld
U = User who has full access to shared mailbox S, e.g. , e.g. bob@example.tld
Get Access Token for User U.
Open an IMAP connection using Username S, but access token obtained for User U in step 1
I think there are 2 fields needed:
Username AND E-Mail Address.
That you can get the Token from the user and use it to connect to mailbox.