This repository was archived by the owner on May 20, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,22 @@ import type {
77 MSALSignoutParams ,
88 MSALResult ,
99} from './types' ;
10+ import { MSALPromptType } from './types' ;
11+
12+ type PromptTypeString = 'consent' | 'login' | 'select_account' | 'none' ;
13+
14+ function promptTypeToString ( promptType : MSALPromptType ) : PromptTypeString {
15+ switch ( promptType ) {
16+ case MSALPromptType . SELECT_ACCOUNT :
17+ return 'select_account' ;
18+ case MSALPromptType . LOGIN :
19+ return 'login' ;
20+ case MSALPromptType . CONSENT :
21+ return 'consent' ;
22+ case MSALPromptType . WHEN_REQUIRED :
23+ return 'none' ;
24+ }
25+ }
1026
1127export default class PublicClientApplication {
1228 private _pca : MSALPublicClientApplication ;
@@ -22,6 +38,7 @@ export default class PublicClientApplication {
2238 * used for acquiring subsequent tokens silently
2339 */
2440 public async acquireToken ( params : MSALInteractiveParams ) : Promise < MSALResult > {
41+ const { promptType, ...paramsWithoutPromptType } = params ;
2542 const {
2643 accessToken,
2744 account,
@@ -30,7 +47,9 @@ export default class PublicClientApplication {
3047 idTokenClaims,
3148 scopes,
3249 tenantId,
33- } = await this . _pca . acquireTokenPopup ( params ) ;
50+ } = await this . _pca . acquireTokenPopup (
51+ promptType ? { ...paramsWithoutPromptType , prompt : promptTypeToString ( promptType ) } : paramsWithoutPromptType
52+ ) ;
3453 return {
3554 accessToken,
3655 account : {
You can’t perform that action at this time.
0 commit comments