Resolving "The user authorized on the connection does not match the session username" error

Condition

In CDP, if you try to open two Hue sessions on different ports on the same browser window, then you may see the The user authorized on the connection does not match the session username error on the Hue web interface and in the Hue logs.

Cause

On CDH, if you opened Hue web URL on port 8889 on one tab and on port 8888 on another tab, you would be logged out of Hue on the port 8889, and you would be forced to refresh the page. In CDP, Hue depends on the ZooKeeper quorum for how it connects to Impala or Hive and how the Hue load balancer distributes the connections to the Hue server nodes and controls switching between the different sesions.

Solution

After migrating/upgrading from CDH to CDP, note this change in behaviour and always open Hue web UI using the Hue Load Balanced - recommended option from Cloudera Manager.