Fix authentication changes in Python 2