Skip to content

Commit 57a1440

Browse files
nmetulevvogtn
andauthored
Fixed TeamsProvider.handleAuth by using instance of userAgentApplication (#820)
Co-authored-by: Nicolas Vogt <[email protected]>
1 parent e7873d6 commit 57a1440

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/providers/mgt-msal-provider/src/MsalProvider.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,15 @@ export class MsalProvider extends IProvider {
111111
public scopes: string[];
112112

113113
/**
114-
* Determines application
114+
* Gets the user agent application instance
115115
*
116116
* @protected
117117
* @type {UserAgentApplication}
118118
* @memberof MsalProvider
119119
*/
120-
protected _userAgentApplication: UserAgentApplication;
120+
public get userAgentApplication() {
121+
return this._userAgentApplication;
122+
}
121123

122124
/**
123125
* client-id authentication
@@ -127,6 +129,8 @@ export class MsalProvider extends IProvider {
127129
* @memberof MsalProvider
128130
*/
129131
protected clientId: string;
132+
133+
private _userAgentApplication: UserAgentApplication;
130134
private _loginType: LoginType;
131135
private _loginHint: string;
132136

packages/providers/mgt-teams-provider/src/TeamsProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export class TeamsProvider extends MsalProvider {
187187
scopes
188188
});
189189

190-
if ((UserAgentApplication.prototype as any).urlContainsHash(window.location.hash)) {
190+
if (provider.userAgentApplication.urlContainsHash(window.location.hash)) {
191191
// the page should redirect again
192192
return;
193193
}
@@ -347,7 +347,7 @@ export class TeamsProvider extends MsalProvider {
347347
}
348348

349349
try {
350-
const response = await this._userAgentApplication.acquireTokenSilent(accessTokenRequest);
350+
const response = await this.userAgentApplication.acquireTokenSilent(accessTokenRequest);
351351
return response.accessToken;
352352
} catch (e) {
353353
if (this.requiresInteraction(e)) {

0 commit comments

Comments
 (0)