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

npm ERR! Unable to authenticate, need: Bearer authorization_uri=https://login.windows.net/*********, Basic realm="https://pkgsprodcus1.pkgs.visualstudio.com/", TFS-Federated Fixed

ERR_CONNECTION_RESET - when you run application from visual studio over https

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