Update controller.py to support v4 authentication