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

The serve command requires to be run in an Angular project, but a project definition could not be found - Fixed

Azure - Failed to deploy web package to App Service. Internal Server Error (CODE: 500)- Fixed

Your global Angular CLI version (8.3.3) is greater than your local version (1.6.5). The local Angular CLI version is used.