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.

System.Net.Http.HttpClient' does not contain a definition for 'PostAsJsonAsync

A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance