Skip to content

Commit

Permalink
fix(oauth2-outlook): Enforce account selection when authenticating OA…
Browse files Browse the repository at this point in the history
…uth2 connections for MS365
  • Loading branch information
andris9 committed Dec 11, 2023
1 parent df680e5 commit 1c6b56a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/oauth/outlook.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,18 @@ class OutlookOauth {
opts = opts || {};

const url = new URL(`https://login.microsoftonline.com/${this.authority}/oauth2/v2.0/authorize`);

url.searchParams.set('client_id', this.clientId);
url.searchParams.set('response_type', 'code');
url.searchParams.set('redirect_uri', this.redirectUrl);
url.searchParams.set('response_mode', 'query');
url.searchParams.set('client_info', '1');
url.searchParams.set('prompt', 'select_account');

if (opts.email) {
url.searchParams.set('login_hint', opts.email);
}

url.searchParams.set('scope', this.scopes.join(' '));

if (opts.state) {
Expand Down

0 comments on commit 1c6b56a

Please sign in to comment.