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"

@ -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