I recently configured oauth authentication for my software in order to fetch/send emails from my outlook or office365 account. I'm using these endpoints
Oauth login successful and both SMTP/IMAP connection tests passed for accounts main mailbox. But I need to access shared mailbox, that account has access to. According to your docs:
In case of shared mailbox access using OAuth, application needs to obtain the access token on behalf of a user but replace the userName field in the SASL XOAUTH2 encoded string with the email address of the shared mailbox.
That's all I need to do, in order for it to work. Although IMAP works fine, SMTP isn't working in this way and returns 535 5.7.3 authentication unsuccessful.
I'm new to office 365 and shared mailboxes, perhaps there is something I need to configure in office 365 admin center, or maybe add another scope? I've read that you shouldn't access shared mail box directly(I'm guessing setting password to mailboxes 'active user' and login like normal account) but I'm not sure why. So seems to me that changing email user in SASL XOAUTH2 encoded string is the only option, or is there any other way?
License - office 365 business standard.