@microsoft/mgt-msal2-provider
Advanced tools
Comparing version 4.2.5-preview.d2add09 to 4.2.5-preview.ea37cbf
@@ -17,3 +17,3 @@ /** | ||
import { IProvider, LoginType, ProviderState, createFromProvider } from '@microsoft/mgt-element'; | ||
import { PublicClientApplication, InteractionRequiredAuthError } from '@azure/msal-browser'; | ||
import { PublicClientApplication, InteractionRequiredAuthError, BrowserAuthError } from '@azure/msal-browser'; | ||
/** | ||
@@ -245,4 +245,21 @@ * Prompt type enum | ||
if (this._loginType === LoginType.Popup) { | ||
const response = yield this._publicClientApplication.loginPopup(loginRequest); | ||
this.handleResponse(response === null || response === void 0 ? void 0 : response.account); | ||
try { | ||
const response = yield this._publicClientApplication.loginPopup(loginRequest); | ||
this.handleResponse(response === null || response === void 0 ? void 0 : response.account); | ||
} | ||
catch (error) { | ||
switch (true) { | ||
case error instanceof BrowserAuthError && error.errorCode === 'user_cancelled': | ||
console.warn('🦒: User cancelled the login flow.'); | ||
this.setState(ProviderState.SignedOut); | ||
break; | ||
case error instanceof BrowserAuthError && error.errorCode === 'interaction_in_progress': | ||
console.warn('🦒: Login already in progess. Close the popup to login again.'); | ||
this.setState(ProviderState.SignedOut); | ||
break; | ||
default: | ||
console.error('🦒: Error occurred during login:', error); | ||
throw error; | ||
} | ||
} | ||
} | ||
@@ -249,0 +266,0 @@ else { |
{ | ||
"name": "@microsoft/mgt-msal2-provider", | ||
"version": "4.2.5-preview.d2add09", | ||
"version": "4.2.5-preview.ea37cbf", | ||
"description": "The Microsoft Graph Toolkit Msal 2.0 Provider", | ||
@@ -47,4 +47,4 @@ "keywords": [ | ||
"@azure/msal-browser": "^2.38.3", | ||
"@microsoft/mgt-element": "4.2.5-preview.d2add09", | ||
"@microsoft/microsoft-graph-client": "3.0.2" | ||
"@microsoft/mgt-element": "4.2.5-preview.ea37cbf", | ||
"@microsoft/microsoft-graph-client": "3.0.7" | ||
}, | ||
@@ -51,0 +51,0 @@ "publishConfig": { |
@@ -27,3 +27,4 @@ /** | ||
EventMessage, | ||
AuthenticationResult | ||
AuthenticationResult, | ||
BrowserAuthError | ||
} from '@azure/msal-browser'; | ||
@@ -480,4 +481,20 @@ import { AuthenticationProviderOptions } from '@microsoft/microsoft-graph-client'; | ||
if (this._loginType === LoginType.Popup) { | ||
const response = await this._publicClientApplication.loginPopup(loginRequest); | ||
this.handleResponse(response?.account); | ||
try { | ||
const response = await this._publicClientApplication.loginPopup(loginRequest); | ||
this.handleResponse(response?.account); | ||
} catch (error) { | ||
switch (true) { | ||
case error instanceof BrowserAuthError && error.errorCode === 'user_cancelled': | ||
console.warn('🦒: User cancelled the login flow.'); | ||
this.setState(ProviderState.SignedOut); | ||
break; | ||
case error instanceof BrowserAuthError && error.errorCode === 'interaction_in_progress': | ||
console.warn('🦒: Login already in progess. Close the popup to login again.'); | ||
this.setState(ProviderState.SignedOut); | ||
break; | ||
default: | ||
console.error('🦒: Error occurred during login:', error); | ||
throw error; | ||
} | ||
} | ||
} else { | ||
@@ -484,0 +501,0 @@ const loginRedirectRequest: RedirectRequest = { ...loginRequest }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
204588
2095
+ Added@microsoft/mgt-element@4.2.5-preview.ea37cbf(transitive)
+ Added@microsoft/microsoft-graph-client@3.0.7(transitive)
- Removed@microsoft/mgt-element@4.2.5-preview.d2add09(transitive)
- Removed@microsoft/microsoft-graph-client@3.0.2(transitive)