Skip to content

Update @azure/msal-browser dependency to v2.8.0 #29226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as Msal from '@azure/msal-browser';
import { StringDict } from '@azure/msal-common';

interface AccessTokenRequestOptions {
scopes: string[];
Expand All @@ -13,7 +12,7 @@ interface AccessTokenResult {

interface AccessToken {
value: string;
expires: Date;
expires: Date | null;
grantedScopes: string[];
}

Expand All @@ -36,7 +35,7 @@ interface AuthenticationResult {
}

interface AuthorizeService {
getUser(): Promise<StringDict | undefined>;
getUser(): Promise<object | undefined>;
getAccessToken(request?: AccessTokenRequestOptions): Promise<AccessTokenResult>;
signIn(state: any): Promise<AuthenticationResult>;
completeSignIn(state: any): Promise<AuthenticationResult>;
Expand All @@ -52,7 +51,7 @@ interface AuthorizeServiceConfiguration extends Msal.Configuration {

class MsalAuthorizeService implements AuthorizeService {
private readonly _msalApplication: Msal.PublicClientApplication;
private _account: Msal.AccountInfo | undefined;
private _account: Msal.AccountInfo | undefined | null;
private _redirectCallback: Promise<AuthenticationResult | null> | undefined;
private _requestedScopes: string[] | undefined;

Expand Down Expand Up @@ -178,10 +177,10 @@ class MsalAuthorizeService implements AuthorizeService {
if (!account) {
return this.error("No account to get tokens for.");
}
const silentRequest = {
const silentRequest : Msal.SilentRequest = {
redirectUri: request.redirectUri,
account: account,
scopes: request.scopes.concat(request.extraScopesToConsent || [])
scopes: request?.scopes?.concat(request.extraScopesToConsent || []) || []
};
await this._msalApplication.acquireTokenSilent(silentRequest);
}
Expand All @@ -198,9 +197,9 @@ class MsalAuthorizeService implements AuthorizeService {
async signInCore(request: Msal.AuthorizationUrlRequest): Promise<Msal.AuthenticationResult | Msal.AuthError | undefined> {
const loginMode = this._settings.loginMode.toLowerCase();
if (loginMode === 'redirect') {
return this.signInWithRedirect(request);
return this.signInWithRedirect(<Msal.RedirectRequest> request);
} else {
return this.signInWithPopup(request);
return this.signInWithPopup(<Msal.PopupRequest> request);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"webpack-cli": "^3.3.10"
},
"dependencies": {
"@azure/msal-browser": "^2.0.0"
"@azure/msal-browser": "2.8.0"
}
}
Loading