fix crash on 401 if _auth is None

Before this change, _authenticate would crash on line 965 if authentication was required when opening a page but auth was left at its default value of None.