Skip to content

Commit 032f559

Browse files
Renamed msalInstance as msalApplication
1 parent 93680f8 commit 032f559

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ const graphScopes = ["user.read", "mail.send"]; // An array of graph scopes
8080

8181
// Important Note: This library implements loginPopup and acquireTokenPopup flow, remember this while initializing the msal
8282
// Initialize the MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js#1-instantiate-the-useragentapplication
83-
const msalInstance = new Msal.UserAgentApplication(msalConfig);
83+
const msalApplication = new Msal.UserAgentApplication(msalConfig);
8484
const options = new MicrosoftGraph.MSALAuthenticationProviderOptions(graphScopes);
85-
const authProvider = new MicrosoftGraph.ImplicitMSALAuthenticationProvider(msalInstance, options);
85+
const authProvider = new MicrosoftGraph.ImplicitMSALAuthenticationProvider(msalApplication, options);
8686
```
8787

8888
#### Creating an instance of ImplicitMSALAuthenticationProvider in node environment
@@ -109,9 +109,9 @@ const graphScopes = ["user.read", "mail.send"]; // An array of graph scopes
109109

110110
// Important Note: This library implements loginPopup and acquireTokenPopup flow, remember this while initializing the msal
111111
// Initialize the MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js#1-instantiate-the-useragentapplication
112-
const msalInstance = new UserAgentApplication(msalConfig);
112+
const msalApplication = new UserAgentApplication(msalConfig);
113113
const options = new MicrosoftGraph.MSALAuthenticationProviderOptions(graphScopes);
114-
const authProvider = new ImplicitMSALAuthenticationProvider(msalInstance, options);
114+
const authProvider = new ImplicitMSALAuthenticationProvider(msalApplication, options);
115115
```
116116

117117
User can integrate own preferred authentication library by implementing `IAuthenticationProvider` interface. Refer implementing [Custom Authentication Provider](./docs/CustomAuthenticationProvider.md).

docs/CreatingClientInstance.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ const msalConfig = {
2424

2525
// Important Note: This library implements loginPopup and acquireTokenPopup flow, remember this while initializing the msal
2626
// Initialize the MSAL @see https://github.com/AzureAD/microsoft-authentication-library-for-js#1-instantiate-the-useragentapplication
27-
const msalInstance = new UserAgentApplication(msalConfig);
27+
const msalApplication = new UserAgentApplication(msalConfig);
2828
const options = new MicrosoftGraph.MSALAuthenticationProviderOptions(<SCOPES>); // An array of graph scopes
2929
let clientOptions: ClientOptions = {
30-
authProvider: new ImplicitMSALAuthenticationProvider(msalInstance, options)
30+
authProvider: new ImplicitMSALAuthenticationProvider(msalApplication, options)
3131
};
3232
const client = Client.initWithMiddleware(clientOptions);
3333
```

samples/browser/src/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ const init = async () => {
1616
},
1717
};
1818

19-
var msalInstance = new Msal.UserAgentApplication(msalConfig);
19+
var msalApplication = new Msal.UserAgentApplication(msalConfig);
2020
const msalOptions = new MicrosoftGraph.MSALAuthenticationProviderOptions(scopes);
21-
const msalProvider = new MicrosoftGraph.ImplicitMSALAuthenticationProvider(msalInstance, msalOptions);
21+
const msalProvider = new MicrosoftGraph.ImplicitMSALAuthenticationProvider(msalApplication, msalOptions);
2222
client = MicrosoftGraph.Client.initWithMiddleware({
2323
debugLogging: true,
2424
authProvider: msalProvider,

src/ImplicitMSALAuthenticationProvider.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ export class ImplicitMSALAuthenticationProvider implements AuthenticationProvide
3131
* @private
3232
* A member holding an instance of MSAL UserAgentApplication
3333
*/
34-
private msalInstance: UserAgentApplication;
34+
private msalApplication: UserAgentApplication;
3535

3636
/**
3737
* @public
3838
* @constructor
3939
* Creates an instance of ImplicitMSALAuthenticationProvider
40-
* @param {UserAgentApplication} msalInstance - An instance of MSAL UserAgentApplication
40+
* @param {UserAgentApplication} msalApplication - An instance of MSAL UserAgentApplication
4141
* @param {MSALAuthenticationProviderOptions} options - An instance of MSALAuthenticationProviderOptions
4242
* @returns An instance of ImplicitMSALAuthenticationProvider
4343
*/
44-
public constructor(msalInstance: UserAgentApplication, options: MSALAuthenticationProviderOptions) {
44+
public constructor(msalApplication: UserAgentApplication, options: MSALAuthenticationProviderOptions) {
4545
this.options = options;
46-
this.msalInstance = msalInstance;
46+
this.msalApplication = msalApplication;
4747
}
4848

4949
/**
@@ -68,17 +68,17 @@ export class ImplicitMSALAuthenticationProvider implements AuthenticationProvide
6868
error.message = "Scopes cannot be empty, Please provide a scopes";
6969
throw error;
7070
}
71-
if (this.msalInstance.getAccount()) {
71+
if (this.msalApplication.getAccount()) {
7272
const tokenRequest: AuthenticationParameters = {
7373
scopes,
7474
};
7575
try {
76-
const authResponse: AuthResponse = await this.msalInstance.acquireTokenSilent(tokenRequest);
76+
const authResponse: AuthResponse = await this.msalApplication.acquireTokenSilent(tokenRequest);
7777
return authResponse.accessToken;
7878
} catch (error) {
7979
if (error instanceof InteractionRequiredAuthError) {
8080
try {
81-
const authResponse: AuthResponse = await this.msalInstance.acquireTokenPopup(tokenRequest);
81+
const authResponse: AuthResponse = await this.msalApplication.acquireTokenPopup(tokenRequest);
8282
return authResponse.accessToken;
8383
} catch (error) {
8484
throw error;
@@ -90,8 +90,8 @@ export class ImplicitMSALAuthenticationProvider implements AuthenticationProvide
9090
const tokenRequest: AuthenticationParameters = {
9191
scopes,
9292
};
93-
await this.msalInstance.loginPopup(tokenRequest);
94-
const authResponse: AuthResponse = await this.msalInstance.acquireTokenSilent(tokenRequest);
93+
await this.msalApplication.loginPopup(tokenRequest);
94+
const authResponse: AuthResponse = await this.msalApplication.acquireTokenSilent(tokenRequest);
9595
return authResponse.accessToken;
9696
} catch (error) {
9797
throw error;

src/browser/ImplicitMSALAuthenticationProvider.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ export class ImplicitMSALAuthenticationProvider implements AuthenticationProvide
3535
* @private
3636
* A member holding an instance of MSAL
3737
*/
38-
private msalInstance: any;
38+
private msalApplication: any;
3939

4040
/**
4141
* @public
4242
* @constructor
4343
* Creates an instance of ImplicitMSALAuthenticationProvider
44-
* @param {any} msalInstance - An instance of MSAL UserAgentApplication
44+
* @param {any} msalApplication - An instance of MSAL UserAgentApplication
4545
* @param {MSALAuthenticationProviderOptions} options - An instance of MSALAuthenticationProviderOptions
4646
* @returns An instance of ImplicitMSALAuthenticationProvider
4747
*/
48-
public constructor(msalInstance: any, options: MSALAuthenticationProviderOptions) {
48+
public constructor(msalApplication: any, options: MSALAuthenticationProviderOptions) {
4949
this.options = options;
50-
this.msalInstance = msalInstance;
50+
this.msalApplication = msalApplication;
5151
}
5252

5353
/**
@@ -73,17 +73,17 @@ export class ImplicitMSALAuthenticationProvider implements AuthenticationProvide
7373
throw error;
7474
}
7575

76-
if (this.msalInstance.getAccount()) {
76+
if (this.msalApplication.getAccount()) {
7777
const tokenRequest = {
7878
scopes,
7979
};
8080
try {
81-
const authResponse = await this.msalInstance.acquireTokenSilent(tokenRequest);
81+
const authResponse = await this.msalApplication.acquireTokenSilent(tokenRequest);
8282
return authResponse.accessToken;
8383
} catch (error) {
8484
if (error.name === "InteractionRequiredAuthError") {
8585
try {
86-
const authResponse = await this.msalInstance.acquireTokenPopup(tokenRequest);
86+
const authResponse = await this.msalApplication.acquireTokenPopup(tokenRequest);
8787
return authResponse.accessToken;
8888
} catch (error) {
8989
throw error;
@@ -95,8 +95,8 @@ export class ImplicitMSALAuthenticationProvider implements AuthenticationProvide
9595
const tokenRequest = {
9696
scopes,
9797
};
98-
await this.msalInstance.loginPopup(tokenRequest);
99-
const authResponse = await this.msalInstance.acquireTokenSilent(tokenRequest);
98+
await this.msalApplication.loginPopup(tokenRequest);
99+
const authResponse = await this.msalApplication.acquireTokenSilent(tokenRequest);
100100
return authResponse.accessToken;
101101
} catch (error) {
102102
throw error;

0 commit comments

Comments
 (0)