andyedinborough / aenetmail

C# POP/IMAP Mail Client
369 stars 153 forks source link

Support for oauth authentication with gmail #65

Closed robitar closed 1 year ago

robitar commented 12 years ago

Having a look at the code, I reckon it would be easy enough (for me) to patch this in, thoughts or comments?

andyedinborough commented 12 years ago

According to https://developers.google.com/google-apps/gmail/oauth_protocol, it doesn't look like it would be that difficult, but I hesitate to add all the code required to do it to the core library. I'm thinking that I would instead like to give the library extensibility points so custom login mechanisms could be easily implemented in clients that use this library.

robitar commented 12 years ago

Agreed, thinking it would be more a matter of passing on all the prebaked parameters and having the correct auth command go on the wire.

andyedinborough commented 12 years ago

I'm thinking about adding a property Action<string,string> CustomLogin, which would be called instead of the hard-coded methods when it's been specified. I would also add an overload to the constructor: public ImapClient(string host, string username, string password, Action<string, string> customLogin, int port = 143, bool secure = false, bool skipSslValidation = false).

It doesn't seem like a very "clean" solution though. Thoughts?

robitar commented 12 years ago

I was going to just hardcode this in (I'm about to do it now actually): use the password field for the xoauth parameter, add another enum field for login type.

The action param is more extensible which is good, but how would you send commands to the imap server? I had a quick look at the code and it looks like the method to send raw commands is protected?