@@ -105,36 +105,37 @@ export class MsalProvider extends IProvider {
105105
106106 async getAccessToken ( options : AuthenticationProviderOptions ) : Promise < string > {
107107 let scopes = options ? options . scopes || this . scopes : this . scopes ;
108- let accessToken : string ;
109108 let accessTokenRequest : AuthenticationParameters = {
110109 scopes : scopes
111110 } ;
112111 try {
113112 let response = await this . _userAgentApplication . acquireTokenSilent ( accessTokenRequest ) ;
114- accessToken = response . accessToken ;
113+ return response . accessToken ;
115114 } catch ( e ) {
116- console . log ( e ) ;
117115 if ( this . requiresInteraction ( e ) ) {
118116 if ( this . _loginType == LoginType . Redirect ) {
119117 // check if the user denied the scope before
120118 if ( ! this . areScopesDenied ( scopes ) ) {
121119 this . setRequestedScopes ( scopes ) ;
122120 this . _userAgentApplication . acquireTokenRedirect ( accessTokenRequest ) ;
121+ } else {
122+ throw e ;
123123 }
124124 } else {
125125 try {
126126 let response = await this . _userAgentApplication . acquireTokenPopup ( accessTokenRequest ) ;
127- accessToken = response . accessToken ;
127+ return response . accessToken ;
128128 } catch ( e ) {
129- console . log ( 'getaccesstoken catch2 : ' + e ) ;
129+ throw e ;
130130 }
131131 }
132132 } else {
133133 // if we don't know what the error is, just ask the user to sign in again
134134 this . setState ( ProviderState . SignedOut ) ;
135+ throw e ;
135136 }
136137 }
137- return accessToken ;
138+ throw null ;
138139 }
139140
140141 updateScopes ( scopes : string [ ] ) {
@@ -161,7 +162,7 @@ export class MsalProvider extends IProvider {
161162 }
162163
163164 private errorReceivedCallback ( authError : AuthError , accountState : string ) {
164- console . log ( 'authError: ' + authError + ' accountState ' + accountState ) ;
165+ // console.log('authError: ' + authError + ' accountState ' + accountState);
165166 let requestedScopes = this . getRequestedScopes ( ) ;
166167 if ( requestedScopes ) {
167168 this . addDeniedScopes ( requestedScopes ) ;
0 commit comments