Skip to content

Commit

Permalink
fix(login): When using slashes in username (indicates an Exchange acc…
Browse files Browse the repository at this point in the history
…ount or drive account), use LOGIN as the authentication mechanism
  • Loading branch information
andris9 committed Jan 17, 2025
1 parent d190ec8 commit 7ac0036
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/imap-flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,10 @@ class ImapFlow extends EventEmitter {
this.expectCapabilityUpdate = true;

let loginMethod = (this.options.auth.loginMethod || '').toString().trim().toUpperCase();
if (!loginMethod && /\\|\//.test(this.options.auth.user)) {
// Special override for MS Exchange when authenticating as some other user or non-email account
loginMethod = 'LOGIN';
}

if (this.options.auth.accessToken) {
this.authenticated = await this.run('AUTHENTICATE', this.options.auth.user, { accessToken: this.options.auth.accessToken });
Expand Down

0 comments on commit 7ac0036

Please sign in to comment.