aenetmail icon indicating copy to clipboard operation
aenetmail copied to clipboard

Support for oauth authentication with gmail

Open robitar opened this issue 12 years ago • 5 comments

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

robitar avatar Apr 06 '12 15:04 robitar

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.

andyedinborough avatar Apr 08 '12 15:04 andyedinborough

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.

robitar avatar Apr 09 '12 08:04 robitar

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?

andyedinborough avatar Apr 09 '12 13:04 andyedinborough

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?

robitar avatar Apr 09 '12 15:04 robitar