Skip to content
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

Support Google IMAP OAUTH or Microsoft Graph API to fetch emails #1399

Open
vladsf opened this issue Jun 20, 2022 · 4 comments
Open

Support Google IMAP OAUTH or Microsoft Graph API to fetch emails #1399

vladsf opened this issue Jun 20, 2022 · 4 comments

Comments

@vladsf
Copy link
Contributor

vladsf commented Jun 20, 2022

Google and Microsoft intend to stop support for password-based login to IMAP and POP
(https://www.bleepingcomputer.com/news/security/google-to-force-oauth-in-g-suite-to-increase-security/)

PHP IMAP extension is not supporting OAUTH tokens yet https://wiki.php.net/todo/ext/imap/xoauth2

I am creating this issue to discuss possible workarounds or future work to support mails server with IMAP OAUTH.

@vladsf vladsf changed the title Support Google IMAP Oauth or Microsoft Graph API to fecth emails Support Google IMAP OAUTH or Microsoft Graph API to fetch emails Jun 20, 2022
@glensc
Copy link
Member

glensc commented Jun 21, 2022

For Google I found that you can use app passwords (rather than account passwords):

@francescobianco
Copy link

Hi @glensc @vladsf in this post I'd propose solution with a trasparent replacement of PHP Imap with support for OAUTH. I hope it help in some way
ddeboer/imap#443 (comment)

@vladsf
Copy link
Contributor Author

vladsf commented Jan 6, 2023

found interesting comment - https://www.php.net/manual/en/language.types.resource.php

'stream' is a general resource type and can have specific subtypes (imap, pop, curl ...). Casting from 'stream' to them makes sense alright.

E.g. Making OAUTH2 work for imap, but still use the normal imap_ functions. Just open a ssl:// stream to the IMAP server with stream_socket_client(), send the "AUTHENTICATE XOAUTH2 ..." authentication with valid token and then use the imap_ functions on the casted 'stream' to 'imap' resource.
Not being able to cast from 'stream' to 'imap' makes it necessary to use 3rd party solutions, like php-imap. Doesn't have to be necessary, if the cast would be possible.

@areis422
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants