Skip to content

Commit

Permalink
MS Provider - prompt option (#435)
Browse files Browse the repository at this point in the history
Add prompt option to indicate user interaction type during login process
  • Loading branch information
Spaeda authored Jul 21, 2021
1 parent c2f648a commit 64dde0c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions microsoft-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ The second argument can have the following fields (all fields are optional):
|protocolMode|ProtocolMode|The protocol to use, AAD or OIDC|`ProtocolMode.AAD`|
|clientCapabilities|string[]|Array of capabilities to be added to all network requests as part of the xms_cc claims request|null|
|cacheLocation|string|Location of token cache in browser|`'sessionStorage'`|
|prompt|string|Indicates the type of user interaction that is required. The only valid values at this time are `login`, `none`, `select_account`, and `consent`|`none`
7 changes: 5 additions & 2 deletions projects/lib/src/providers/microsoft-login-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export type MicrosoftOptions = {
protocolMode?: ProtocolMode,
clientCapabilities?: string[],
cacheLocation?: string,
scopes?: string[]
scopes?: string[],
prompt?: string,
};

// Collection of internal MSAL interfaces from: https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-browser/src
Expand Down Expand Up @@ -52,6 +53,7 @@ interface MSALLoginRequest {
sid?: string;
loginHint?: string;
domainHint?: string;
prompt?: string;
}

interface MSALLoginResponse {
Expand Down Expand Up @@ -205,7 +207,8 @@ export class MicrosoftLoginProvider extends BaseLoginProvider {

async signIn(): Promise<SocialUser> {
const loginResponse = await this._instance.loginPopup({
scopes: this.initOptions.scopes
scopes: this.initOptions.scopes,
prompt: this.initOptions.prompt,
});
return await this.getSocialUser(loginResponse);
}
Expand Down

0 comments on commit 64dde0c

Please sign in to comment.