Add xoauth2 support

fork
Brian White 12 years ago
parent 876a212ab6
commit 36d65c6d8f

@ -375,7 +375,9 @@ ImapConnection Functions
* **password** - <_string_> - Password for plain-text authentication.
* **xoauth** - <_string_> - OAuth token for [OAuth authentication](https://sites.google.com/site/oauthgoog/Home/oauthimap) for servers that support it.
* **xoauth** - <_string_> - OAuth token for [OAuth authentication](https://sites.google.com/site/oauthgoog/Home/oauthimap) for servers that support it (See Andris Reinman's [xoauth.js](https://github.com/andris9/inbox/blob/master/lib/xoauth.js) module to help generate this string).
* **xoauth2** - <_string_> - OAuth2 token for [The SASL XOAUTH2 Mechanism](https://developers.google.com/google-apps/gmail/xoauth2_protocol#the_sasl_xoauth2_mechanism) for servers that support it (See Andris Reinman's [xoauth2](https://github.com/andris9/xoauth2) module to help generate this string).
* **host** - <_string_> - Hostname or IP address of the IMAP server. **Default:** "localhost"
@ -637,4 +639,4 @@ Several things not yet implemented in no particular order:
* UNSELECT (via UNSELECT extension -- http://tools.ietf.org/html/rfc3691)
* SORT (via SORT extension -- http://tools.ietf.org/html/rfc5256)
* THREAD (via THREAD=ORDEREDSUBJECT and/or THREAD=REFERENCES extension(s) -- http://tools.ietf.org/html/rfc5256)
* ID (via ID extension -- http://tools.ietf.org/html/rfc2971) ?
* ID (via ID extension -- http://tools.ietf.org/html/rfc2971) ?

@ -1198,6 +1198,9 @@ ImapConnection.prototype._login = function(cb) {
if (this._serverSupports('AUTH=XOAUTH') && 'xoauth' in this._options) {
this._send('AUTHENTICATE XOAUTH ' + utils.escape(this._options.xoauth),
fnReturn);
} else if (this._serverSupports('AUTH=XOAUTH2') && 'xoauth2' in this._options) {
this._send('AUTHENTICATE XOAUTH2 ' + utils.escape(this._options.xoauth2),
fnReturn);
} else if (this._options.username !== undefined
&& this._options.password !== undefined) {
this._send('LOGIN "' + utils.escape(this._options.username) + '" "'

Loading…
Cancel
Save