Invalid state. ''bad, state expected : null. in msal Angular

When you are using MSAL in angular app you encounter this error "Invalid state. ''bad, state expected : null" while calling "getCachedTokenInternal" method. 

Typescript shows pass string in intelligence and if you are now aware about state then you will pass blank string like "" but it gives above error. 

Solution

Pass the state as "null" as below.

var token = super.getCachedTokenInternal(scopes, this.getAccount(), null);

For more refer git error explanation - Invalid state Expected: null


Thanks



Comments

Popular posts from this blog

Swagger for Azure functions: Undocumented TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body. Fixed.

Fixed: The required column was not present in the results of a 'FromSql' operation in asp.net core EF core

Severity Code Description Project File Line Suppression State Error Unable to resolve dependencies. 'Xamarin.Android.Support.Design 24.2.1' is not compatible with 'Xamarin.Forms 2.3.3.180 constraint: Xamarin.Android.Support.Design (= 23.3.0)'. 0