@microsoft/mgt-msal2-provider
Advanced tools
Comparing version 4.2.5 to 4.3.0-preview.9666b8b
@@ -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", | ||
"version": "4.3.0-preview.9666b8b", | ||
"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", | ||
"@microsoft/microsoft-graph-client": "3.0.2" | ||
"@microsoft/mgt-element": "4.3.0-preview.9666b8b", | ||
"@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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
1
+ Added@microsoft/mgt-element@4.3.0-preview.9666b8b(transitive)
+ Added@microsoft/microsoft-graph-client@3.0.7(transitive)
- Removed@microsoft/mgt-element@4.2.5(transitive)
- Removed@microsoft/microsoft-graph-client@3.0.2(transitive)