-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Google OAuth Support #411
Comments
Very good point! Right now, it's not supported yet, unfortunately. I've added a few functions in order to support OAuth, but I couldn't test it yet. It should later work like this: // Create PhpImap\Mailbox instance for all further actions
$mailbox = new PhpImap\Mailbox(
'{imap.gmail.com:993/imap/ssl}INBOX', // IMAP server and mailbox folder
'some@gmail.com', // Username for the before configured mailbox
'*********', // Password for the before configured username
__DIR__, // Directory, where attachments will be saved (optional)
'UTF-8' // Server encoding (optional)
);
try {
$mailbox->setOAuthToken('TheOAuthAccessToken');
} catch (Exception $ex) {
die('Authentication using OAuth failed! Error: '.$ex->getMessage());
}
try {
$mailsIds = $mailbox->searchMailbox('ALL');
} catch(PhpImap\Exceptions\ConnectionException $ex) {
die('IMAP connection failed: '.$ex);
}
if(!$mailsIds) {
die('Mailbox is empty');
}
$mail = $mailbox->getMail($mailsIds[0]); You can give it a try by using the I'll try to implement a working and tested solution, but this will earliest happen next year due to the current holidays. Any help would be appreciated. Useful references:
|
running automated testing for this would require changes mentioned in #432 (comment), or finding an IMAP-enabled mail provider that supports automated account creation w/ oauth imap so the account can be created & deleted on each travis build. |
Please forgive me asking, but are there any updates on this? It would be so helpful to have OAuth support for e.g. GMail/Google Workspace, and Microsoft Office 365 mail accounts. I'm willing to help / do the implementation, what is the current status? |
There are no updates yet. I've tried to work and implement it some time ago, so the current progress is available in the respective branch: 411-OAuth-Support Feel free to submit your own pull request or add commits to the existing one. |
Hi! @freescout-helpdesk @Sebi94nbg @hrst @bapcltd-marv @rmontagud The strategy to overcome the problem is replacing all the
etc... The idea behind the imap2 library is to replace the core php imap extension with a new one written in PHP. I'm waiting from your feedback! I hope that imap2 is a good replacement for imap |
Just a heads-up to everyone: Microsoft will disable Basic Auth on Oct 1st, 2022. In contrast to Google, "App Passwords" will not be possible/allowed, only OAuth2. Status for PHP imap_* extension (page not updated since 2020 as of writing this): https://wiki.php.net/todo/ext/imap/xoauth2 |
When we plan to add support for oAuth to this package? |
is there any plan to support oAuth? because Microsoft will disable Basic Auth in Januar 2023 |
Hello, as a workaround is there maybe the possibility to login using another library, like https://www.php-imap.com/ that does support oauth and then pass the object in some way to keep working with this php-imap library? We built a whole app using this library and we would do anything to avoid rewriting everything... Thanks! |
Hello everyone, These changes are still on the Pull requests by other people are also welcome. Since christmas time is coming soon and I'm also currently working on some other projects, I can't gurantee, that I can finish this implementation until end of December 2022. However, I'll try my best to get it done. |
has anyone be able to get this to work correctly I am trying to update for Outlook update. |
hi everyone,
within the next 7 days basic auth will be deactivated, so we need a solution soon.... |
@barbushin any plan to manage OAUTH? |
Same here |
Is Google OAuth authentication supported in this library? google/gmail-oauth2-tools#18
The text was updated successfully, but these errors were encountered: