Move BasicAuth check to "isLoggedIn()"

Ensures that Basic Auth works properly for APIs and removes the need for some even uglier lines of code.