If you have gotten “Perforce password (P4PASSWD) invalid or unset” error message when you’ve switched to the ticket based authentication, here’s what you can do to fix the problem:

p4 login -p -a

Simple. Straight forward.