Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

modifying php-imap extension to allow oauth authentication

My php application logs into to Gmail via oauth provided access keys and fetch headers for all messages in inbox. The php-imap extension allows only for login/password based authentication. I want to modify the extension so that it support oauth based authentication too. I need to figure out how to make that change inside the extension code itself and compile it. Bad part, I do not have much clue where to make changes and how to compile a php extension

Earlier I was using the Zend provided IMAP classes for this task. They are very slow and gmail tends to disconnect the connection if it takes more than 40-45 minutes or so. For very large inboxes this was happening frequently. I tested this with php-imap extension and it worked almost 10 times faster that the zend one (i guess since its written in C)

So I need to figure out how and where authentication is taking place in the current php-imap code and how do i re-compile it after making the changes.

Any pointers are appreciated.

like image 286
Nands Avatar asked Nov 06 '22 07:11

Nands


1 Answers

PHP wraps the c-client libary, so the first thing you would have to check would be if there's a way to use OAuth authentication with that library. You may try this mailing list.

The PHP extension is implemented in just one file. You won't have trouble finding out where the connection/authentication takes place.

like image 61
Artefacto Avatar answered Nov 09 '22 03:11

Artefacto