If your cPanel license gets out of sync with cPanel's server or it needs to be synced for the first time or upgraded, you may have an invalid license error when you attempt to log in to the WHM or cPanel. To fix this, you can log in to the shell as root and execute the following command:
/usr/local/cpanel/cpkeyclt
The result should be:
/usr/local/cpanel/cpkeyclt
Updating cPanel license...Done. Update succeeded.
Building global cache for cpanel...Done
Or
Updating cPanel license...Done. Update succeeded.
Once you see this message, just refresh your cPanel or WHM in your browser and it will be updated.
You can also conveniently run this code from the terminal section in your WHM.