ImapHandler trying to use a non valid resource stream

Trying to do Oauth connection for inbound emails but I am encountering the following issue:

However, I have generated the access tokens successfully!

Following is the error which pops up in the suit log as I click on monitored folders option :
Using imap handler class: Imap2Handler
Wed Jan 4 15:41:26 2023 [10670][1][FATAL] ImapHandler trying to use a non valid resource stream.

Do you have a SuiteCRM version number that you can give us?

You’re probably just facing the regular Microsoft email problems that everyone had after Microsoft hardened their security requirements. It’s solved in SuiteCRM v7.13

$suitecrm_version = ‘7.11.12’;
My friend is running the same thing on 7.11 .12 and its working fine over there!

But does your friend also use a Microsoft account just like yours?

Any way, 7.13 re-worked all this area of the code.

My aim is not to update my version but to implement the specific exact updates of 7.13 in my version to enable oauth configuration in inbound emails.

I’m afraid that route will prove exceedingly complex. It’s a very large PR with tons of changes, and you need to understand a lot about that code in order to get the parts that are relevant or applicable to your version.

I am quite sure that sorting out whichever update problems you have, and actually do the upgrade, will turn out to be simpler. But you can do as you prefer, of course.

The issue has been resolved! I mistakenly copied wrong changes in modules/InboundEmail/InboundEmail.php

I would suggest all to do the changes very carefully!

The folders are appearing now but now I am facing another issue which I will update very soon if I get stuck!