Browse Source

Fix null-ref for MSAL WASM Auth (#35872)

* Add token null check

* Revert "Add token null check"

This reverts commit 662f04935e758e0557d7d162e1fad2a559944235.

* Update AuthenticationService.ts
Tanay Parikh 4 years ago
parent
commit
68d3ff18d4

+ 1 - 1
src/Components/WebAssembly/Authentication.Msal/src/Interop/AuthenticationService.ts

@@ -125,7 +125,7 @@ class MsalAuthorizeService implements AuthorizeService {
     async getTokenCore(scopes?: string[]): Promise<AccessToken | undefined> {
         const account = this.getAccount();
         if (!account) {
-            return;
+            throw new Error('Failed to retrieve token, no account found.');
         }
 
         this._requestedScopes = scopes;